Context Free Grammar - adamishaq/Virtual-Ecology-Workbench GitHub Wiki

Planktonika Context-Free Grammar: Items in bold have been updated

Rules ::= Rule '\n' | Rule '\n' Rules

Rule ::= Assign |
'if' BExpr 'then' Rule |
'uptake' '(' ID ',' Expr ')' |
'release' '(' ID ',' Expr ')' |
'ingest' '(' ID ',' Expr ',' Expr ')' |
'change' '(' ID ')' |
'pchange' '(' ID ',' Expr ')' |
'divide' '(' Expr ')' |
Create

Assign ::= Id '=' Expr

AssignList ::= Assign | Assign ',' AssignList

Create ::= 'create' '(' Id ',' Expr ')' |
'create' '(' Id ',' Expr ')' 'with' '[' AssignList ']'

Expr ::= Num |
Id |
'if' BExpr 'then' Expr 'else' Expr |
Expr Op Expr |
VOp '(' Expr ')' |
UPrim '(' Expr ')' |
BinPrim '(' Expr ',' Expr ')' |
'integrate' '(' Expr ')' |
'varhist' '(' Id ',' Expr ')'

BExpr ::= Expr Comp Expr |
'not' '(' BExpr ')' |
BExpr BOp BExpr |
VBOp '(' BExpr ')'
'(' BExpr ')'

UPrim ::= 'abs' | 'acos' | 'asin' | 'atan' | 'cos' |
'exp' | 'log' | 'log10' | 'rnd' | 'sin' |
'sqrt' | 'tan' | 'densityAt' | 'depthForFI' |
'depthForVI' | 'fullIrradAt' | 'salinityAt' |
'temperatureAt' | 'UVIrradAt'

BinPrim ::= 'max' | 'min'

Op ::= '+' | '-' | '*' | '/' | '^'

Comp ::= '=' | '<>' | '>' | '<' | '=>' | '=<'

BOp ::= 'and' | 'or'

VOp ::= 'average' | 'product' | 'sum'

VBOp ::= 'all' | 'some' | 'none'

⚠️ **GitHub.com Fallback** ⚠️