# BNF for ParseCpsl.jj

## NON-TERMINALS

MultiPhaseTransducer | ::= | ( <multiphase> <ident> )? ( ( SinglePhaseTransducer )+ | ( <phases> ( <path> )+ ) ) <EOF>
SinglePhaseTransducer | ::= | <phase> <ident> ( <input> ( <ident> )* )? ( <option> ( <ident> <assign> ( <ident> | <bool> ) )* )? ( ( Rule ) | MacroDef )*
Rule | ::= | <rule> <ident> ( <priority> <integer> )? LeftHandSide "-->" RightHandSide
MacroDef | ::= | <macro> <ident> ( PatternElement | Action )
LeftHandSide | ::= | ConstraintGroup
ConstraintGroup | ::= | ( PatternElement )+ ( <bar> ( PatternElement )+ )*
PatternElement | ::= | ( <ident> | BasicPatternElement | ComplexPatternElement )
BasicPatternElement | ::= | ( ( <leftBrace> Constraint ( <comma> Constraint )* <rightBrace> ) | ( <string> ) )
ComplexPatternElement | ::= | <leftBracket> ConstraintGroup <rightBracket> ( <kleeneOp> )? ( <colon> ( <ident> | <integer> ) )?
Constraint | ::= | ( <pling> )? <ident> ( <period> <ident> <equals> AttrVal )?
AttrVal | ::= | ( <string> | <ident> | <integer> | <floatingPoint> | <bool> )
RightHandSide | ::= | Action ( <comma> Action )*
Action | ::= | ( NamedJavaBlock | AnonymousJavaBlock | AssignmentExpression | <ident> )
NamedJavaBlock | ::= | <colon> <ident> <leftBrace> ConsumeBlock
AnonymousJavaBlock | ::= | <leftBrace> ConsumeBlock
AssignmentExpression | ::= | ( <colon> | <colonplus> ) <ident> <period> <ident> <assign> <leftBrace> ( <ident> <assign> ( AttrVal | ( <colon> <ident> <period> <ident> <period> <ident> ) ) ( <comma> )? )* <rightBrace>
ConsumeBlock | ::= | java code