| Model | ::= | ( ( <BEGIN> <MODEL> ( <BEGIN> ( CompartmentsBlock | ParameterBlock | MolecularDefinitionBlock | AnchorsBlock | SeedSpeciesBlock | ReactionRulesBlock | ObservablesBlock | FunctionsBlock ) )+ <END> <MODEL> ( Action )* ) | ( ( <BEGIN> ( CompartmentsBlock | ParameterBlock | MolecularDefinitionBlock | AnchorsBlock | SeedSpeciesBlock | ReactionRulesBlock | ObservablesBlock | FunctionsBlock ) )+ ( Action )* ) ) |
| FunctionsBlock | ::= | <FUNCTIONS> ( FunctionDecl )* <END> <FUNCTIONS> |
| CompartmentsBlock | ::= | <COMPARTMENTS> ( Compartment )* <END> <COMPARTMENTS> |
| ParameterBlock | ::= | <PARAMETERS> ( Parameter )* <END> <PARAMETERS> |
| MolecularDefinitionBlock | ::= | <MOLECULE> <TYPES> ( ( <INTEGER> )? MolecularTypePattern )* <END> <MOLECULE> <TYPES> |
| AnchorsBlock | ::= | <ANCHORS> ( Anchors )* <END> <ANCHORS> |
| SeedSpeciesBlock | ::= | <SEED> <SPECIES> ( ( <INTEGER> )? SeedSpecies )* <END> <SEED> <SPECIES> |
| ReactionRulesBlock | ::= | <REACTION> <RULES> ( ( <INTEGER> )? ReactionRule )* <END> <REACTION> <RULES> |
| ObservablesBlock | ::= | <OBSERVABLES> ( Observable )* <END> <OBSERVABLES> |
| Compartment | ::= | ( <INTEGER> )? ( <IDENTIFIER> ) ( <INTEGER> ) ( "{" Expression "}" ) |
| Parameter | ::= | ( <INTEGER> )? ( <IDENTIFIER> ) ( "{" Expression "}" ) |
| SeedSpecies | ::= | ( <ATSIGN> ( <LABEL> ) )? ( <CLAMP> )? SpeciesPattern ( "{" Expression "}" ) |
| Observable | ::= | ( ( <INTEGER> )? ( ( <MOLECULES> ) | ( <SPECIES> ) ) ( <IDENTIFIER> ) ( ObservablePattern ( ( <COMMA> )? ObservablePattern )* ) ) |
| ObservablePattern | ::= | ( <ATSIGN> ( <LABEL> ) )? SpeciesPattern ( ( ( "=" <INTEGER> ) | ( ">" <INTEGER> ) )? ) |
| FunctionDecl | ::= | ( <IDENTIFIER> ) "(" ")" "=" ( Expression ) |
| ReactionRule | ::= | ( <LABEL> ) Reactant ( <ADD> Reactant )* ( ( <REACTION_ARROW_RIGHT> ) | ( <REACTION_ARROW_BOTH> ) ) Product ( <ADD> Product )* KineticsParameter ( <COMMA> KineticsParameter )? |
| Reactant | ::= | ( <ATSIGN> ( <LABEL> ) )? SpeciesPattern |
| Product | ::= | ( <ATSIGN> ( <LABEL> ) )? SpeciesPattern |
| KineticsParameter | ::= | Expression |
| SpeciesPattern | ::= | MolecularTypePattern ( <DOT> MolecularTypePattern )* |
| MolecularTypePattern | ::= | ( <IDENTIFIER> ) Components ( <VARIABLE_ATTRIBUTE> ( <INTEGER> ) )? |
| Anchors | ::= | ( <IDENTIFIER> ) "(" ( ( Anchor ( ( <COMMA> )? Anchor )* ) )? ")" |
| Anchor | ::= | ( <IDENTIFIER> ) |
| Action | ::= | <ACTION> |
| Components | ::= | "(" ( ComponentList )? ")" |
| ComponentList | ::= | ( MolecularComponentPattern ) ( "," MolecularComponentPattern )* |
| MolecularComponentPattern | ::= | ( <IDENTIFIER> ( AttributePattern )* ( BondPattern )? ) |
| AttributePattern | ::= | ( ( <NAMED_ATTRIBUTE> ( ( ( <IDENTIFIER> ) | ( <INTEGER> ) ) ) ) | ( <VARIABLE_ATTRIBUTE> ( <INTEGER> ) ) ) |
| BondPattern | ::= | ( <BOND> <INTEGER> ) |
| | | ( <BOND> <ADD> ) | |
| | | ( <BOND> <QUESTION_MARK> ) | |
| | | ( <BOND> <MINUS> ) | |
| Expression | ::= | ( StringLiteral ";" | LogicalORExpression ) |
| LogicalORExpression | ::= | ( LogicalANDExpression ( <OR> LogicalANDExpression )* ) |
| LogicalANDExpression | ::= | ( RelationalExpression ( <AND> RelationalExpression )* ) |
| RelationalExpression | ::= | AdditiveExpression ( ( <RELATIONAL_OPERATOR_WITHOUT_LT_GT> | <LT> | <GT> ) AdditiveExpression )? |
| AdditiveExpression | ::= | ( MultiplicativeExpression ( ( <ADD> MultiplicativeExpression ) | MinusTerm )* ) |
| MinusTerm | ::= | <SUB> MultiplicativeExpression |
| MultiplicativeExpression | ::= | ( PowerTerm ( ( <MULT> PowerTerm ) | DivTerm )* ) |
| DivTerm | ::= | <DIV> PowerTerm |
| PowerTerm | ::= | ( UnaryExpression ( <POWER> UnaryExpression )* ) |
| UnaryExpression | ::= | ( <SUB> UnaryExpression ) |
| | | ( <NOT> UnaryExpression ) | |
| | | PrimaryExpression | |
| PrimaryExpression | ::= | Function |
| | | Name | |
| | | Float | |
| | | "(" LogicalORExpression ")" | |
| Function | ::= | ( <IDENTIFIER> Arguments ) |
| Arguments | ::= | "(" ( ArgumentList )? ")" |
| ArgumentList | ::= | ( StringLiteral | LogicalORExpression ) ( "," ( StringLiteral | LogicalORExpression ) )* |
| Float | ::= | ( <FLOATING_POINT_LITERAL> | <INTEGER> ( <DOT> )? ) |
| Name | ::= | <IDENTIFIER> |
| StringLiteral | ::= | <QUOTE> <IDENTIFIER> <QUOTE> |