Skip to content

Command line

Leon Starr edited this page Jul 30, 2026 · 2 revisions

The command line interface exists for diagnostics. It parses a file and tells you whether it is valid — it does not print the population, since the point of the parser is to hand that to an execution engine. See Parser output for the library interface.

Installing the package puts a sip command on your path:

$ pip install sip-parser
$ sip EVMAN_three_bank1.sip

No problemo

No problemo means the file parsed. Otherwise the parse error comes out as an uncaught exception, so you get a Python traceback with the useful part at the bottom:

$ sip broken.sip
Traceback (most recent call last):
  ...
sip_parser.exceptions.SIParseError:
Scenario instance population parser: [Parse error in scenario "broken.sip"
	Expected rnum or iword or '_state' at position (4, 1) => ' -- Cabin *shaft -- {'."]

Read the last three lines and ignore the traceback above them. The position is a line and column, and the excerpt that follows it puts a * at the character where the parse failed — here the lowercase shaft, which cannot start a column name.

Bear in mind that the marked position is where the grammar ran out of options, which is not always where the mistake is. A missing -- separator typically reports a line or two further on, at whatever the parser hit while still expecting more rows.

Options

sip <file>.sip        Parse the file and report
sip -D <file>.sip     Parse in debug mode
sip -V                Print the parser version

Debug mode writes two PDFs into a diagnostics directory beneath the current working directory, creating it if needed: a rendering of the parse tree for your file, and a rendering of the grammar as a parser model. These are for working on the grammar itself rather than on a scenario file. Producing them shells out to graphviz, so dot has to be on your path or the intermediate .dot files will be left behind unconverted.

Either way a log is written to SI_parser.log in the current working directory.

Running from the repository

Working from a clone without installing, the module is runnable directly as long as src is on the Python path:

$ PYTHONPATH=src python -m sip_parser tests/scenarios/EVMAN_three_bank1.sip

Clone this wiki locally