Next: , Previous: , Up: The Dezyne command-line tools   [Contents][Index]

9.7 Invoking dzn parse

The 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:

  1. The PEG parser creates a raw parse-tree10,
  2. The parse-tree is converted into the abstract syntax tree (AST),
  3. A number of so-called “well-formedness” checks are performed on the AST that ascertain type correctness and detect semantic errors (See Well-formedness),
  4. After parsing, some commands perform a normalization on the AST.

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 dzn).

Usually, the parser is invoked implicitly by commands like dzn verify and 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 optionFILE

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.

-I dir

Add directory dir to the import path.


List the Dezyne models defined in the file, with their type.


Show locations in output ast.

-m model

Only output ast for model model.


Write the raw peg parse tree, skip generating a full ast,

-o file

Write ast to file, use “-” for standard output.



The dzn language command (See Invoking dzn language) works on this raw parse-tree.

Next: Invoking dzn simulate, Previous: Invoking dzn lts, Up: The Dezyne command-line tools   [Contents][Index]