-
Notifications
You must be signed in to change notification settings - Fork 14
BNF grammar of the Kendrick DSL
Bui Thi Mai Anh edited this page Dec 14, 2020
·
7 revisions
This document need to be corrected
<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>}]
<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> ::= <Attribute-Declaration>";"{<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>
<model-clause> ::= "model: '" <identifier> "'"
<Scenario-Declaration> ::= "Scenario" <identifier> <scenario-body>
<scenario-body> ::= <on-clause> <population-clause> [{<scenario-expression>";"}<scenario-expression>]"."
<on-clause> ::= "on: '" <identifier> "';"
<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: '" <identifier>"';"
<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: '" <identifier> "'"
<visualization-expression> ::= "legends: " <array> | "xLabel: " <string> | "yLabel: " <string> | "legendTitle: " <string> | "data: " <short-expression>