BNF for Parser.jj

NON-TERMINALS

Start ::= Command ";"
| Statement ";"
| ";"
| <EOF>
Command ::= <HELP> ( <IDENTIFIER> )?
| <QUIT>
| <INPUT> <STRING_LITERAL>
| <DEBUG>
| <TIME>
| <TRACE>
| <DD> IDList
| <DR> ( IDList | EventName ( "[" IDList "]" )? )
| <PR> ( Expression | EventName ( "[" IDList "]" )? )
| <SD> ( <IDENTIFIER> )?
| <SR> ( <IDENTIFIER> )?
| <SC> <IDENTIFIER>
| <SRD>
| <PRINT> <STRING_LITERAL>
| <SSD>
| <SSR>
| <UNDO>
| <EVENTON> EventName ( "[" IDList "]" )?
| <EVENTOFF> EventName ( "[" IDList "]" )?
Statement ::= SequentialStatement
SequentialStatement ::= ParallelStatement ( <SEQUENCE> ParallelStatement )*
ParallelStatement ::= ChoiceStatement ( <PARALLEL> ChoiceStatement )*
ChoiceStatement ::= PrimaryStatement ( <CHOICE> PrimaryStatement )*
PrimaryStatement ::= Declaration
| Assignment
| Update
| ComputationCall
| Conditional
| ForLoop
| WhileLoop
| Exit
| DeadLock
| Exec
| "(" Statement ")"
| StatementBlock
StatementBlock ::= "{" Statement ( ";" Statement )* ( ";" )? "}"
Conditional ::= <IF> Expression <THEN> ( Statement | Command ) ( <ELSE> ( Statement | Command ) )?
ForLoop ::= ( <FOR> Identifier )? ( <FROM> Expression )? ( <TO> Expression )? ( <BY> Expression )? <DO> Statement
WhileLoop ::= <WHILE> Expression <DO> Statement
Exit ::= <EXIT>
DeadLock ::= <DEADLOCK>
Exec ::= <EXEC> Identifier
Declaration ::= <RELATION> IDList "(" IDList ")" ( Initialization )?
| Identifier ( <INITIAL> Expression )? <IS> Expression ( <TARGET> Expression )?
| <DOMAIN> IDList Type
| <LET> ( Identifier | Eval ) ( <INITIAL> Expression )? <BE> Expression
| <COMP> CompName "(" ( ParameterList )? ")" <IS> ComputationBody
Initialization ::= <ASSIGN> ( "{" ConstantTupleList "}" | Identifier | FilePath )
| <RCOPY> ( Identifier | FilePath )
| <IS> ( Identifier | FilePath )
ConstantTupleList ::= ( ConstantTuple ( "," ConstantTuple )* )?
ConstantTuple ::= "(" Constant ( "," Constant )* ")"
Constant ::= Literal
| "{" ConstantTupleList "}"
Identifier ::= <IDENTIFIER>
FilePath ::= <STRING_LITERAL>
Assignment ::= Identifier ( AssignOperator Expression | "[" IDList AssignOperator ExpressionList "]" Expression )
AssignOperator ::= <ASSIGN>
| <ASSIGNADD>
Update ::= <UPDATE> Identifier ( UpdateOperator Expression | <CHANGE> ( StatementList )? ( <USING> UsingClause )? | "[" IDList UpdateOperator ExpressionList "]" Expression )
UpdateOperator ::= <ADD>
| <DELETE>
StatementList ::= Statement ( "," Statement )*
UsingClause ::= Identifier
| "(" Expression ")"
| JoinOperator Expression
| "[" ExpressionList ":" JoinOperator ( ":" )? ExpressionList "]" Expression
IDList ::= Identifier ( "," Identifier )*
ExpressionList ::= Expression ( "," Expression )*
Expression ::= Disjunction
Disjunction ::= Conjunction ( <OR> Conjunction )*
Conjunction ::= Comparison ( <AND> Comparison )*
Comparison ::= Concatenation ( ComparativeOperator Concatenation )?
Concatenation ::= MinMax ( <CAT> MinMax )*
MinMax ::= Summation ( MinMaxOperator Summation )*
Summation ::= JoinExpression ( AdditiveOperator JoinExpression )*
JoinExpression ::= Projection ( ( JoinOperator Projection | "[" ExpressionList ":" JoinOperator ( ":" )? ExpressionList "]" Projection ) )*
Projection ::= Projector ( ( <IN> | <FROM> ) Projection | Projector <GEDIT> Expression | <GEDIT> Expression | Selection )
| Selection
Projector ::= ( QuantifierOperator )? "[" ( ExpressionList )? "]"
Selection ::= Selector
| QSelector
| Term
Selector ::= ( <WHERE> | <WHEN> ) Expression ( <IN> | <FROM> ) Projection
| <EDIT> ( Projection )?
| <ZORDER> Projection
QSelector ::= <QUANT> QuantifierList ( ( <WHERE> | <WHEN> ) Expression )? ( <IN> | <FROM> ) Projection
QuantifierOperator ::= "."
| "%"
| "#"
QuantifierList ::= Quantifier ( "," Quantifier )*
Quantifier ::= "(" Expression ")" Expression
Term ::= Factor ( MultiplicativeOperator Factor )*
Factor ::= UnaryOperator Factor
| Power
Power ::= Primary ( <POW> Power )*
Primary ::= Literal
| QuantifierOperator
| ArrayElement
| PositionalRename
| Identifier
| Cast
| "(" Expression ")"
| Pick
| AttribsOf
| Quote
| Transpose
| Function
| IfThenElseExpression
| VerticalExpression
ArrayElement ::= Identifier "[" ArrayIndexList "]"
ArrayIndexList ::= ( Expression )? ( "," ( Expression )? )*
PositionalRename ::= Identifier "(" ( IDList )? ")"
Cast ::= "(" Type ")" Primary
Pick ::= <PICK> Selection
AttribsOf ::= <ATTRIBSOF> Selection
Eval ::= <EVAL> Expression
QuoteIdentifier ::= ( Quote | Identifier )
Quote ::= <QUOTE> Identifier
Transpose ::= <TRANSPOSE> ExpressionList
Function ::= FunctionOperator "(" Expression ")"
Literal ::= <NULL>
| <DC>
| <DK>
| <TRUE>
| <FALSE>
| ( SignOperator )? ( <INTEGER_LITERAL> | <FLOAT_LITERAL> )
| <NUMERIC_LITERAL>
| <STRING_LITERAL>
SignOperator ::= <PLUS>
| <MINUS>
IfThenElseExpression ::= <IF> Expression <THEN> Expression <ELSE> Expression
VerticalExpression ::= <RED> ( ComputationCall | AssoCommuOperator ) <OF> Expression
| <EQUIV> ( ComputationCall | AssoCommuOperator ) <OF> Expression <BY> ExpressionList
| <FUN> ( ComputationCall | OrderedOperator ) <OF> Expression <ORDER> ExpressionList
| <PAR> ( ComputationCall | OrderedOperator ) <OF> Expression ( <ORDER> ExpressionList <BY> ExpressionList | <BY> ExpressionList <ORDER> ExpressionList )
Type ::= <UNIVERSAL>
| <ATTRIBUTE>
| <BOOLEAN>
| <SHORT>
| <INTEGER>
| <LONG>
| <FLOAT>
| <DOUBLE>
| <NUMERIC>
| <STRING>
| <TEXT>
| <STATEMENT>
| <EXPRESSION>
| <COMP> "(" ( IDList )? ")"
| "(" IDList ")"
AssoCommuOperator ::= <OR>
| <AND>
| <MIN>
| <MAX>
| <PLUS>
| <IJOIN>
| <UJOIN>
| <SJOIN>
| <MUL>
| <NOP>
OrderedOperator ::= AssoCommuOperator
| <CAT>
| <MINUS>
| <DIV>
| <MOD>
| <POW>
| <PRED>
| <SUCC>
ComparativeOperator ::= <SUBSTR>
| <EQ>
| <NEQ>
| <GT>
| <LT>
| <GE>
| <LE>
MinMaxOperator ::= <MIN>
| <MAX>
AdditiveOperator ::= <PLUS>
| <MINUS>
JoinOperator ::= <NOP>
| MuJoin
| ( <NOT> )? SigmaJoin
MuJoin ::= <IJOIN>
| <UJOIN>
| <DJOIN>
| <SJOIN>
| <LJOIN>
| <RJOIN>
| <DLJOIN>
| <DRJOIN>
SigmaJoin ::= <ICOMP>
| <EQJOIN>
| <GTJOIN>
| <GEJOIN>
| <LTJOIN>
| <LEJOIN>
| <IEJOIN>
MultiplicativeOperator ::= <MUL>
| <DIV>
| <MOD>
UnaryOperator ::= <PLUS>
| <MINUS>
| <NOT>
FunctionOperator ::= <ABS>
| <SQRT>
| <SIN>
| <ASIN>
| <COS>
| <ACOS>
| <TAN>
| <ATAN>
| <SINH>
| <COSH>
| <TANH>
| <LOG>
| <LOG10>
| <ROUND>
| <CEIL>
| <FLOOR>
| <ISKNOWN>
| <CHR>
| <ORD>
ParameterList ::= Parameter ( "," Parameter )*
Parameter ::= <IDENTIFIER> ( ":" <SEQ> )?
ComputationBody ::= ComputationVariableDeclaration ComputationBlock ( <ALT> ComputationBlock )*
ComputationBlock ::= ( <REDOP> | <FUNOP> )? "{" ComputationStatements "}"
ComputationVariableDeclaration ::= ( LocalVariableDeclaration | StateVariableDeclaration )*
LocalVariableDeclaration ::= <LOCAL> IDList Type ";"
StateVariableDeclaration ::= <STATE> IDList Type ";"
ComputationStatements ::= CompStatement ( ( ";" CompStatement | <ALSO> CompStatement ) )* ( ";" )?
CompStatement ::= Statement
| Command
ComputationCall ::= Identifier ( "(" ( CallParameterList )? ")" )?
CallParameterList ::= CallParameter ( "," CallParameter )*
CallParameter ::= ( <IN> ( Literal | Identifier )? )
| ( <OUT> ( Literal | Identifier )? )
CompName ::= CompIdentifier
| EventName ( "[" IDList "]" )?
CompIdentifier ::= <IDENTIFIER>
EventName ::= ( Prefix ":" )? Action ":" ( Identifier )?
Prefix ::= <PRE>
| <POST>
Action ::= <ADD>
| <DELETE>
| <CHANGE>
| <CONTAINS>
| <CMPCONTAINS>
| <CMPWITHIN>
| <INTERSECT>
| <WITHIN>
| <WITHINDIST>