-
Notifications
You must be signed in to change notification settings - Fork 0
Instance grammar
Below the column header and its -- separator comes one row per instance:
Bank
Name | Passenger load time | Block clear time | Max close attempts | Average cabin speed | Average stop duration
--
L { [Lower Floors] [4.0] [2.0] [25] [7.0] [9.0] }
P { [Penthouse] [4.0] [2.0] [25] [7.0] [9.0] }
F { [Freight] [7.0] [5.0] [25] [5.0] [14.0] }
--
The grammar is:
instance_block = row+ block_end
row = (word SP+)? '{' SP* val (SP+ val)* SP* '}' initial_state* EOL+
Reading the row term left to right there are four parts, two of them optional:
- an optional alias followed by at least one space
- the braced list of values, one per header column
- zero or more initial states
- the end of the line
Each row must supply at least one value, so { } is not a row. And the block must contain at least one row, so
there is no such thing as an empty class population.
The SP* and SP+ terms around the values mean the parser is relaxed about spacing inside the braces. All
three of these are the same row:
{ [S1] [true] }
{[S1] [true]}
{ [S1] [true] }
Padding is discarded, so use it freely to line the columns up as the Bank example above does. This is the only
place in a sip file where extra spaces are allowed — names, the | header separator and the initial state
syntax are all spacing exact. See Comments and whitespace.
Tabs are not accepted anywhere. { [S1]\t[true] } is a parse error, so align with spaces.
The trailing EOL+ on a row lets you break the block up. Blank lines and whole comment lines are both fine
between rows, which is handy for grouping a long population:
Shaft Level
Shaft | Floor
--
// Shaft S1 serves every floor
{ [S1] [PH] }
{ [S1] [8] }
{ [S2] [PH] }
{ [S2] [8] }
--
The parser counts neither the columns in the header nor the values in a row, so it will not catch a row that is a value short or a value long. Only the syntax is checked here; lining the two up is left to whatever consumes the result. See Parser output.
Copyright 2025-2026 © Leon Starr under MIT Open Source License