dzn parse command parses a Dezyne file and reports any
errors, both syntax errors as well as “well-formedness” errors. The
Dezyne parser consists of three stages:
parse-treeis converted into the abstract syntax tree (
ASTthat ascertain type correctness and detect semantic errors (See Well-formedness),
The well-formedness checking of a large program can take a significant
amount of time. As the well-formedness check does not change a correct
AST in any way, it can be safely skipped when parsing a
previously checked and unmodified program (See Invoking
Usually, the parser is invoked implicitly by commands like
dzn code. It can be useful to do an explicit
check for errors, for example after saving a Dezyne file (See The Perfect Setup). Its syntax is:
dzn dzn-option… parse option… FILE
The options can be among the following:
Resolve imports and produce a content stream. This pre-processed content can also be processed later by the parser and it has the advantage of being independent of the file-system.
Display help on invoking
dzn parse, and then exit.
Add directory dir to the import path.
List the Dezyne models defined in the file, with their type.
Show locations in output ast.
Only output ast for model model.
Write the raw peg parse tree, skip generating a full ast,
Write ast to file, use “-” for standard output.