# parsesdc

> Parse an SDC (Synopsys Design Constraints) file with an ANTLR4 grammar and write it back -- a structural front end and Java API for timing-constraint tools.

- Catalog id: `Parsesdc`; bundle: `parsesdc`; latest version 20261018
- Documentation page: https://edautils.com/DownloadLinks.html
- Keywords: SDC parser, timing constraints, ANTLR SDC grammar
- Terms: as stated on edautils.com, EDAUtils tools are free for commercial and academic use, with no license server. The bundle's own metadata says: "Free to evaluate with the bundled licence; commercial licences from help@edautils.com". Licence prerequisites per tool are under "How an agent runs it".
- This file: https://edautils.com/capabilities/parsesdc.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Parsesdc (latest file `parsesdc-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/parsers-liberty-upf-sdc-vcd/files/parsesdc/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/parsesdc-20261018.tar.gz (release `RELEASE_20261018`; all releases: https://github.com/edautils/releases/releases)

## How an agent runs it

The following is the AGENTS.md shipped at the root of the bundle.

Parses an SDC (Synopsys Design Constraints) file with an ANTLR4 grammar (`SDC.g4`) and writes it
back out (default `output.sdc`). It is a structural parse of the one file: `source` is not
followed, `$variables` are not substituted and nothing is executed. This is the grammar-layer
front end; sdc-shell and comparesdc are the ones that execute SDC as Tcl and build the data model.
Main class: `com.eu.miscedautils.sdcgrammar.ReadSDCAndPrintBack` (jar `lib/designplayer.jar`;
the `.bat` launcher uses the same class).

### Where it ships

Its own bundle, `parsesdc.tar.gz` (flow `parsesdc`; release tree `release_scripts/parsesdc/1.0`,
jar `lib/designplayer.jar`), and as a point tool in the **sdc-shell** bundle (`bin/parsesdc`, jar
`lib/sdc.jar`) and the **designplayer-shell** bundle (`lib/designplayer.jar`); a shell carries this
guide as `tools/parsesdc/AGENTS.md` and the examples under `tools/parsesdc/examples/`. The
regression harness runs the tool through `tools/regress/bin/parsesdc`.

### Prerequisites

- Java on `PATH` (the launcher runs plain `java`). Use Java 11 or newer (Java 21 recommended: the
  release is built and regression-tested with OpenJDK 21); the bundled JAXB and Eclipse libraries
  are class-file version 55, so a Java 8 runtime fails with `UnsupportedClassVersionError`.
- `EDAUTILS_ROOT` = the unpacked bundle directory (must contain `bin/` and `lib/`). The
  launcher exits 1 with "Environment variable EDAUTILS_ROOT is not set" otherwise.
  `source setup_env.sh` (or `setup_env.csh`) from the bundle root sets `EDAUTILS_ROOT`,
  prepends `bin/` to `PATH` and sets
  `CLASSPATH=$EDAUTILS_ROOT/lib/designplayer.jar`. It does **not** set `EDAUTILS_LICENSE_FILE`;
  set it yourself.
- Licence: a valid licence file. No licence-feature check is made (no `SDCPARSER` checkout),
  so any valid EDAUtils licence runs it. No valid licence: exit status 10 (messages 6037/6405).
  The licence file is searched in this order: `$EDAUTILS_LICENSE_FILE`, `./edautils.lic` (run
  directory), `$HOME/edautils.lic`, `$EDAUTILS_ROOT/edautils.lic`.
- Optional environment: `JAVA_FLAGS` (passed to the JVM; with no heap option in it the launcher adds `-Xmx` sized to the machine (`bin/eu_heap.sh`: the largest of 64/32/16/12/8/4 GB within 3/4 of physical or cgroup memory, else 2 GB; `EDAUTILS_MAX_HEAP_GB` caps it)), `EDAUTILS_LOG_FILE` /
  `EDAUTILS_APPEND_LOG_FILE` (log file name; the second appends),
  `EDAUTILS_DISABLE_USAGE_TRACKING=true`, `EDAUTILS_PRINT_STACK_TRACE` (stack traces on
  internal exceptions). No tool-specific environment variables are read.
- No external tools needed.

### Invocation

```
parsesdc -in <file.sdc> [-out <file>] [-user <email>]
```

| Option | Meaning |
|---|---|
| `-in <file>` | SDC file to read (mandatory; any extension) |
| `-out <file>` | Output SDC file (default `output.sdc`) |
| `-user <email>` | Usage-tracking user id |
| `-help` | Print usage and return (`-h` is not recognised) |

There is no `-nobanner`, `-quiet` or `-suppress`. Any other option prints Error 9421
"Unrecognized option : <opt>" followed by the usage. With no arguments, or without `-in`, the
usage is printed. An option given without its value throws an index exception, which is
printed as an internal error; the exit status is 0.

### Inputs / Outputs

- Reads: the `-in` file only. `source` lines are kept as commands, not opened.
- Writes: `-out` (default `output.sdc` in the current directory), only if the file parsed
  without a syntax error. The print-back is each command's own source text, so constraints
  come back as written. It is not byte-exact: comments are only partly kept (the file's
  leading comment block is dropped; comments directly above a command survive), and
  `;`-separated commands on one line are rejoined without the blank after `;` (compare `tests/parsesdc/complex_tcl/complex_tcl.sdc`
  with its `decompiled.sdc.gld`).
- A backslash escapes the next character in a bareword or brace word, so a regexp such as
  `-regexp {^(.*)\.sync\[([0-9]+)\]}` is one word (no substitution happens in braces); several
  `[..]` groups may follow in one word (`a[0][1]`). A `[` after blank or brace starts a command.
- Log: `ParseSDC.log` in the current directory (override with `EDAUTILS_LOG_FILE`).

### Exit status and messages

- 0 on a normal finish, **including runs that reported errors** (syntax errors, missing input
  file, usage errors). 10 = no valid licence file. 1 = `EDAUTILS_ROOT` missing/invalid (launcher).
- Message format: `ParseSDC: <Severity>: <id>: <text>` (the prefix is `ParseSDC`, not
  `parsesdc`); `<id>` is a 5-digit message number. Usage lines have no severity or id.
- Key messages: `File '<f>' not found ...` (Error 9411; nothing written), the ANTLR syntax
  error text (Error 9413; nothing written), `Completed  parsing ...`,
  `Written decompiled SDC in file : <out>`.
- A run that parses ends with `ParseSDC: Note: <id>: Found N error(s) and M warning(s) ...`.
  The usage paths return before that summary.

### Examples

In `release_scripts/parsesdc/1.0/examples/`, each with a `runme.csh`:

| Directory | Command |
|---|---|
| `comprehensive_sdc` | `parsesdc -in comprehensive.sdc -out output.sdc` |
| `tcl_constructs` | `parsesdc -in tcl_constructs.sdc -out output.sdc` |
| `complex_tcl` | `parsesdc -in complex_tcl.sdc -out output.sdc` (its `constraints/*.tcl` are sourced by the file but not read by parsesdc) |

From the regression suite (reference: `tests.edautilscommandline/tests/parsesdc/*/runme.csh`
via `../runme_common.csh`; golden `decompiled.sdc.gld`; four cases, the largest
`black_parrot`, about 200 KB):

```
parsesdc -in black_parrot.sdc -out decompiled.sdc
```

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log and default output into the current directory: give each parallel run its
  own working directory (or distinct `-out` and `EDAUTILS_LOG_FILE`).
- Set `EDAUTILS_DISABLE_USAGE_TRACKING=true` to stop usage registration.
- Success test: exit status 0 **and** the log contains `Found 0 error(s)` **and** the `-out`
  file exists.
- A clean parse proves syntax only. To evaluate the constraints (variables, `source`, procs),
  run them through `sdc-shell -f <file>`.

### See also

sdc-shell, comparesdc, parseupf (the same front-end shape for UPF).
