-
Notifications
You must be signed in to change notification settings - Fork 14
BNF grammar of the Kendrick DSL
Serge Stinckwich edited this page Jan 3, 2020
·
7 revisions
<Kendrick-Script> ::= <Kendrick-Entity>"." {<Kendrick-Entity>"."}
<Kendrick-Entity> ::= <KModel-Declaration> | <Composition-Declaration> | <Scenario-Declaration> | <Simulation-Declaration> | <Visualization-Declaration>
<identifier> ::= <letter>{<letter> | <digit>}
<composite_identifier> ::= <identifier>"_"<identifier>{"_"<identifier>}
<letter> ::= a-z|A-Z
<digit> ::= 0-9
<number> ::= <digit>{<digit>}[.{<digit>}]
<string> ::= "'"<letter>|<digit>{<letter>|<digit>}"'"
<equation> ::= <equation-signature> "=" <equation-expression>
<equation-signature> ::= <identifier> ":" <identifier>
<equation-expression> ::= <term> [+|-] {<equation-expression>}
<term> ::= [(]<number> | <identifier> | <composite_identifier> |<product>
<product> ::= * | / <term>
<array> ::= "#(" <values> | <short-expression> ")"
<values> ::= <value>{" "<value>}
<value> ::= <number> | <string> | <array>
<short-expression> ::= <equation-expression> [<basic-operator>{<basic-operator>}]
<basic-operator> ::= sum | sqrt | log | size | min | max | avg | sin | cos
<KModel-Declaration> ::= "KendrickModel" <identifier> <model-body>
<model-body> ::= {<model-expression>";"}<model-expression>"."
<model-expression> ::= <Attribute-Declaration> | <Parameters-Declaration> | <assignment-clause> | <Equations-Declaration> | <Transitions-Declaration>
<Attribute-Declaration> ::= "attribute: #(" <identifier> "->" <identifier>{" " <identifier>} ")"
<Parameters-Declaration> ::= "parameters: #(" <identifier> {" " <identifier>} ")"
<Equations-Declaration> ::= "equations: " <equation-array>
<equation-array> ::= "#(" <equation> {"." <equation>} ")"
<Transitions-Declaration> ::= "transitions: " <transition-array>
<transition-array> ::= "#(" <transition> {"." <transition>} ")"
<transition> ::= <identifier> "--" <identifier> "-->" <identifier>
<assignment-clause> ::= <identifier>|<composite_identifier> ":" <value>
<Composition-Declaration> ::= "Composition" <identifier> <composition-body>
<composition-body> ::= {<composition-expression>";"}<composition-expression>"."
<composition-expression> ::= <model-clause> | <Parameters-Declaration> | <assignment-clause>
<Scenario-Declaration> ::= "Scenario" <identifier> <scenario-body>
<scenario-body> ::= <on-clause> <population-clause> [{<scenario-expression>";"}<scenario-expression>]"."
<on-clause> ::= "on: " <string> ";"
<population-clause> ::= "populationSize: " <number>
<scenario-expression> ::= <assignment-clause>
<Simulation-Declaration> ::= "Simulation" <identifier> <algorithm> <simulation-body>
<algorithm> ::= rungeKutta | gillespie | ibm
<simulation-body> ::= {<simulation-scenario>}<simulation-scenario> <simulation-time>
<simulation-scenario> ::= "scenario: " <string>";"
<simulation-time> ::= "from: " <number>; "to: " <number>; "step: " <number>"."
<Visualization-Declaration> ::= "Visualization" <identifier> <visualization-module> <visualization-body>
<visualization-module> ::= diagram | map
<visualization-body> ::= <for-clause> [";"{<visualization-expression>";"}<visualization-expression>]"."
<for-clause> ::= "for: " <string>
<visualization-expression> ::= "legends: " <array> | "xLabel: " <string> | "yLabel: " <string> | "legendTitle: " <string> | "data: " <short-expression>