-
Notifications
You must be signed in to change notification settings - Fork 4
Model syntax
Matej Troják edited this page Aug 25, 2020
·
5 revisions
This section describes the syntax of model files (the .bcs
format). The BCSL model is composed from several sections: rules contains the set of rules defining the behaviour of the model, inits defines the initial state of the model, definitions allows to assign parameter values, and (optional) complexes defines aliases for complexes.
The syntax of BCSL models is given by the following context-free grammar in EBNF notation:
model: rules inits definitions (complexes)?
rules: "#! rules" (rule|COMMENT)+
inits: "#! inits" (init|COMMENT)+
definitions: "#! definitions" (definition|COMMENT)+
complexes: "#! complexes" (complex_def|COMMENT)+
init: const? rate_complex (COMMENT)?
definition: def_param "=" number (COMMENT)?
rule: side "=>" side ("@" rate)? (";" variable)? (COMMENT)?
complex_def: complex_name "=" sequence (COMMENT)?
side: (const? complex "+")* (const? complex)?
complex: (abstract_sequence|sequence) "::" compartment
rate_complex: sequence "::" compartment
sequence: (agent ".")* agent
agent: atomic | structure
structure: s_name "(" composition ")"
composition: (atomic ",")* atomic?
atomic: a_name "{" state "}"
!state: (digit|letter|"+"|"-"|"*"|"_")+
!rate: fun "/" fun | fun
!fun: const | param | rate_agent | fun "+" fun |
| fun "-" fun | fun "*" fun | fun "**" const | "(" fun ")"
!rate_agent: "[" rate_complex "]"
abstract_sequence: atomic_complex | atomic_structure_complex | structure_complex
atomic_complex: atomic ":" (complex_name|"?")
atomic_structure_complex: atomic ":" structure ":" (complex_name|"?")
structure_complex: structure ":" (complex_name|"?")
variable: "?" "=" "{" complex_name ("," complex_name)+ "}"
COMMENT: "//" /[^\n]/*
where obvious terminals such as names, constants and numbers are omitted for simplicity. These are specified as following:
-
digit
- a single digit ("0".."9"
) -
letter
- a single letter ("a".."z" | "A".."Z"
) -
const
- integer or decimal number (digit+ "." digit+? | digit+
) -
complex_name
,compartment
,s_name
,a_name
,param
- specified name (("_"|letter) ("_"|letter|digit)*
)
Examples of BCSL models can be found in Shared Libraries.
Note that the parser is available through an API online. The usage is explained here.