Next: Invoking dzn simulate
, Previous: Invoking dzn lts
, Up: The Dezyne command-line tools [Contents][Index]
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:
parse-tree
10,
parse-tree
is converted into the abstract syntax tree
(AST
),
AST
that ascertain type correctness and detect semantic errors
(See Well-formedness),
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 option… FILE
The options can be among the following:
--preprocess
-E
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.
--help
-h
Display help on invoking dzn parse
, and then exit.
--import=dir
-I dir
Add directory dir to the import path.
--list-models
List the Dezyne models defined in the file, with their type.
--locations
-L
Show locations in output ast.
--model=model
-m model
Only output ast for model model.
--parse-tree
-t
Write the raw peg parse tree, skip generating a full ast,
--output=file
-o file
Write ast to file, use “-” for standard output.
Next: Invoking dzn simulate
, Previous: Invoking dzn lts
, Up: The Dezyne command-line tools [Contents][Index]