A model is a list of declarations followed by a reactive system in a begin ... end block. Declarations define constants of type int, float or string, controls with ctrl, bigraphs with big and reactions with react. A reactive system has a kind (brs, pbrs, sbrs or abrs), an initial bigraph given by init, a list of rules, and optional parameters, actions and predicates.
| name_char | ::= | a…z ∣ A…Z ∣ 0…9 ∣ _ ∣ ' |
| ident | ::= | a…z name_char* |
| ctrl_ident | ::= | A…Z name_char* |
| digit_or_underscore | ::= | 0…9 ∣ _ |
| int | ::= | 0…9 digit_or_underscore* |
| float | ::= | inf |
| ∣ | 0…9 digit_or_underscore* (. digit_or_underscore* )? | |
(e ∣ E (+ ∣ -)? 0…9 digit_or_underscore* )? | ||
| string | ::= | " (name_char ∣ -)* " |
| eof | ::= | end of file |
Identifiers must start with the letter shown; control names use an uppercase
letter, all other names a lowercase one. Integer and float literals may contain underscore
separators. Strings may contain no spaces and have no escape sequences.
Whitespace (space, tab, form feed and newline) and # comments (to end of line)
may appear between any two tokens.
| bracketed_exp | ::= | [
exp
] |
| dec_list | ::= | ( dec; )+ |
| ctrl_exp | ::= | ctrl
ctrl_ident
=
int |
| ∣ | fun
ctrl
ctrl_ident
( ide_list_nonempty )
=
int |
| dec_big | ::= | big
ident
=
bexp |
| ∣ | fun
big
ident
( ide_list_nonempty )
=
bexp |
| dec_react | ::= | react
ident
=
bexp
arrow
bexp
[ eta_exp ]
[ conds ] |
| ∣ | fun
react
ident
( ide_list_nonempty )
=
bexp
arrow
bexp
[ eta_exp ]
[ conds ] |
| arrow | ::= | --> |
| ∣ | -[
exp
]-> |
| place | ::= | param |
| ∣ | ctx |
| eta_exp | ::= | @
[ int_list ] |
| end_pos | ::= | end |
| rs_type | ::= | brs |
| ∣ | pbrs | |
| ∣ | sbrs | |
| ∣ | abrs |
| params | ::= | [ ( param; )+ ] |
| pred_def | ::= | ident [ bracketed_exp ] |
| ∣ | ident
( exp_list )
[ bracketed_exp ] |
| actions | ::= | [ actions
=
[
action_def ( , action_def )*
]
; ] |
| action_def | ::= | ident
[ [ exp ] ]
=
{
rule_with_loc ( , rule_with_loc )*
} |
| rule_with_loc | ::= | ident |
| exp | ::= | add_exp |
| param | ::= | int
ide_list_nonempty
=
param_int_exp |
| ∣ | float
ide_list_nonempty
=
param_float_exp | |
| ∣ | string
ide_list_nonempty
=
param_str_exp |
| rules | ::= | rules
=
[
[ priority_class ( , priority_class )* ]
]
; |
| bexp | ::= | bpar_exp |
| bcomp_exp | ::= | bprefix_exp ( * bprefix_exp )* |
| bprefix_exp | ::= | wire_exp
( bexp ) |
| ∣ | wire_exp ion_exp | |
| ∣ | wire_exp
ion_exp
.
simple_bexp | |
| ∣ | wire_exp ident | |
| ∣ | wire_exp
ident
( exp_list ) | |
| ∣ | share
simple_bexp
by
simple_bexp
in
simple_bexp | |
| ∣ | simple_bexp |
| simple_bexp | ::= | ( bexp ) |
| ∣ | ( bexp )
( bexp ) | |
| ∣ | id_exp | |
| ∣ | merge
[ ( int ) ] | |
| ∣ | split
[ ( int ) ] | |
| ∣ | /
ident | |
| ∣ | ident
/
{ ide_list_nonempty } | |
| ∣ | { ident } | |
| ∣ | int | |
| ∣ | (
[
[ { int_list } ( , { int_list } )* ]
]
,
int
) | |
| ∣ | ident | |
| ∣ | ident
( exp_list ) | |
| ∣ | ion_exp | |
| ∣ | ion_exp
.
simple_bexp | |
| ∣ | par
( exp , bexp ) | |
| ∣ | ppar
( exp , bexp ) |
| id_exp | ::= | id
[ ( int ) ] |
| ∣ | id
{ ide_list_nonempty } | |
| ∣ | id
( int
, { ide_list_nonempty } ) |
| ion_exp | ::= | ctrl_ident
[ { ide_list_nonempty } ] |
| ∣ | ctrl_ident
(
ctrl_param_exp_top ( , ctrl_param_exp_top )*
)
[ { ide_list_nonempty } ] |
| ctrl_param_exp_top | ::= | exp |
| ∣ | [ ident ] | |
| ∣ | [
ident
:
constraint_exp
] | |
| ∣ | [ constraint_exp ] | |
| ∣ | [ [ ctrl_param_exp ] ] |
| ctrl_param_exp | ::= | ctrl_param_add |
| ctrl_param_add | ::= | ctrl_param_mul |
| ∣ | ctrl_param_add
+
ctrl_param_mul | |
| ∣ | ctrl_param_add
-
ctrl_param_mul |
| ctrl_param_mul | ::= | ctrl_param_unary |
| ∣ | ctrl_param_mul
*
ctrl_param_unary | |
| ∣ | ctrl_param_mul
/
ctrl_param_unary |
| ctrl_param_unary | ::= | ctrl_param_atom |
| ∣ | -
ctrl_param_unary |
| ctrl_param_atom | ::= | $ |
| ∣ | int | |
| ∣ | float | |
| ∣ | string | |
| ∣ | ident | |
| ∣ | abs
( ctrl_param_exp ) | |
| ∣ | ( ctrl_param_exp ) |
| constraint_exp | ::= | constraint_or |
| constraint_or | ::= | constraint_and ( || constraint_and )* |
| constraint_and | ::= | constraint_atom ( && constraint_atom )* |
| constraint_atom | ::= | comparison |
| ∣ | !
( constraint_exp ) | |
| ∣ | ( constraint_exp ) |
| comparison | ::= | ctrl_param_exp
=
ctrl_param_exp |
| ∣ | ctrl_param_exp
!=
ctrl_param_exp | |
| ∣ | ctrl_param_exp
<
ctrl_param_exp | |
| ∣ | ctrl_param_exp
<=
ctrl_param_exp | |
| ∣ | ctrl_param_exp
>
ctrl_param_exp | |
| ∣ | ctrl_param_exp
>=
ctrl_param_exp |
| wire_exp | ::= | closure+ |
| ∣ | ident
/
{ ide_list_nonempty } | |
| ∣ | /
{ ide_list_nonempty } |
| closure | ::= | /
ident |
Bigraph expressions (bexp) can be combined using these operators. They have the following precedence, from strongest to weakest:
* + | and ||
The operators | and || have the same precedence and associate to the left. For example, the expression
A | B + C * D || E
is parsed as
(A | (B + (C * D))) || E
Parentheses can be used to override this convention.
Arithmetic expressions (exp), as used in actions, parameters, rewards, rates and arguments, combine the following operators. Their precedence, from strongest to weakest, is:
^ - (unary) * and / + and -
The operator ^ associates to the right, so a ^ b ^ c is a ^ (b ^ c). The remaining operators associate to the left. The unary - is weaker than ^, so -a ^ b is -(a ^ b).
Control parameter expressions (ctrl_param_exp), the arguments of a control ion, use the same operators as arithmetic expressions except ^, with the same precedence and associativity.
Constraint expressions (constraint_exp), in the square brackets of a control ion's parameters, combine the following operators. Their precedence, from strongest to weakest, is:
= != < <= > >= ! && ||
Comparison expressions cannot be chained. The operator ! applies to a parenthesised constraint. The operators && and || associate to the left.