ReturnType ::= ':' TypeExp | { NamedType() }.
Keywordp-Star0 ::= '::' Name = $head Keywordp-Star0 = $tail Cons | Nil .
Properties ::= '[' Property = p Properties-Star0 = ps ']' | Seq{} .
AddPattern-Dis0 ::= '+' AddPattern = p2 { Addp(p1,p2) } | .
OpMulti ::= '.' Pattern = multi { Seq{multi} } | Seq{} .
SeqExp ::= LinePos = l 'Seq{' SeqExp-Dis0 .
Property ::= Name = n '=' Exp = e { Seq{n,e} }.
Varp ::= AName = name Varp-Dis0 = pattern Varp-Dis1 = type { Varp(name,pattern,type) }.
OpArg ::= Pattern | '!' Drop .
Import ::= 'import' ImportPath = path ';' { Import(path) }.
Properties-Star0 ::= ',' Property = $head Properties-Star0 = $tail Cons | Nil .
NonEmptySeqTail ::= Expr = e PairOrElements .
OpArgs ::= OpArg = arg OpArgs-Star0 = args | Seq{} .
BindValue ::= OptType = type '=' SimpleExp = value { ValueBinding(name,type,value) }.
OpArgs-Star0 ::= ',' OpArg = $head OpArgs-Star0 = $tail Cons | Nil .
Drop ::= '<' DropExp = e '>' { Drop(resolve(order(e))) } | '<|' Pattern = p '|>' { DropPattern(p) }.
OpName ::= AName = name { if name.isKindOf(String)
then
Symbol(name)
else
name
end } | { Symbol("anonymous") }.
BindFunArgsTail ::= Pattern = p BindFunArgsTail-Star0 = ps ')' | ')' Seq{} .
Operation-PlusCons0 ::= Exp = $head Operation-PlusCons0-Star0 = $tail Cons .
AddPattern ::= AtomicPattern = p1 AddPattern-Dis0 .
Operation ::= OpName = name Properties = ps '(' OpArgs = args OpMulti = multi ')' ReturnType = type Operation-PlusCons0 = body 'end' pState = p { ps->iterate(p x = Operation(name,args + multi,type).add(body).setIsMultiArgs(not multi->isEmpty).setImports(p.imports->excluding(XCore)->excluding(Root)->map("pathSeq")) |
[| .setProperty(at(0))>,at(1)>) |]) }.
IfTail ::= 'else' Expr 'end' | LinePos = l 'elseif' Expr = e1 'then' Expr = e2 IfTail = e3 { If(l,e1,e2,e3) } | 'end' { BoolExp(false) }.
Operation-PlusCons0-Star0 ::= Exp = $head Operation-PlusCons0-Star0 = $tail Cons | Nil .
Def ::= 'context' Def-Dis0 = isForward ImportPath = path Exp = exp { ContextDef(path,exp,isForward) }.
Def-Dis0 ::= '!' { true } | { false }.
SetExp ::= LinePos = l 'Set{' CommaSepExps = es '}' { SetExp(l,"Set",es) }.
Throw ::= LinePos = l 'throw' SimpleExp = value { Throw(l,value) }.
LogicalExp ::= SimpleExp = e { resolve(order(e)) }.
Pattern-Star0 ::= PatternTail = $head Pattern-Star0 = $tail Cons | Nil .
Keyps-Star0 ::= ',' Keyp = $head Keyps-Star0 = $tail Cons | Nil .
Keywordp ::= Name = name Keywordp-Star0 = names '[' Keyps = keys ']' { Keywordp(name,names,keys) }.
VarExp ::= Name = name LinePos = l { Var(name,l) }.
Parentheses ::= '(' Expr = e ')' { Parentheses(e) }.
KeyArgs-Dis0 ::= ']' Seq{} | KeyArg = arg KeyArgs-Dis0-Star0 = args ']' .
CollMessage ::= '(' CommaSepExps = as ')' { CollExp(c,n,as) }.
ArgsTail-Star0 ::= ',' Expr = $head ArgsTail-Star0 = $tail Cons | Nil .
Exp ::= Expr = e ! { resolve(order(e)) }.
Seqp ::= 'Seq{' Pattern = head SeqpTail = tail { Consp(head,tail) }.
ArrowTail ::= Name = n CollOp = x Arrow .
Varp-Dis0 ::= '=' Pattern | null .
Atom ::= VarExp ! | Self ! | StrExp ! | IntExp ! | IfExp ! | BoolExp ! | LetExp ! | CollExp ! | Parentheses | Drop | Lift | Throw | Try | ImportIn | FloatExp | LocalParserImport | AtExp .
ImportPath ::= Name = n ImportPath-Star0 = ns .
EvaluationUnit ::= EvaluationUnit-Star0 EvaluationUnit-Star1 = imports EvaluationUnit-Star2 = exps EOF { Evaluator::EvaluationUnit(imports,exps) }.
Objectp ::= Name = name Objectp-Star0 = names '(' Patterns = slots ')' { Objectp(name,names,slots) }.
CollOp ::= CollMessage | Collect | Iterate | { CollExp(c,n,Seq{}) }.
BindingList ::= Binding = binding BindingList-Star0 = bindings .
ParserImport ::= 'parserImport' Name = name ParserImport-Star0 = names ';' ImportAt.
DropExp ::= 'not' DropExp = e { Negate(e) } | Apply = a DropExpTail .
KeyArg ::= Name = name '=' Expr = exp { KeyArg(name,exp) }.
BindFunArgs ::= '(' BindFunArgsTail .
Patterns-Star0 ::= ',' Pattern = $head Patterns-Star0 = $tail Cons | Nil .
AName ::= Name ! | Drop .
Syntaxp ::= '[|' Exp = e '|]' { Syntaxp(e) }.
IfExp ::= LinePos = l 'if' Expr = e1 'then' Expr = e2 IfTail = e3 { If(l,e1,e2,e3) }.
CompilationUnit-Star0 ::= ParserImport = $head CompilationUnit-Star0 = $tail Cons | Nil .
Constp ::= Intp | Strp | Boolp | Expp .
EvaluationUnit-Star2-Dis0 ::= Def | TopLevelExp .
Self ::= LinePos = l 'self' { Self(l) }.
TopLevelExp ::= SimpleExp = s ';' { resolve(order(s)) }.
LocalParserImport ::= 'parserImport' Name = name LocalParserImport-Star0 = names ImportAt 'in' Expr = e 'end' { ParserImport(Seq{name | names},e) }.
PathExp-Dis0 ::= '::' AName = name PathExp-Dis0-Star0 = names { Path(atom,Seq{name | names}) } | .
LocalParserImport-Star0 ::= '::' Name = $head LocalParserImport-Star0 = $tail Cons | Nil .
Keyps ::= Keyp = key Keyps-Star0 = keys | Seq{} .
Try ::= LinePos = l 'try' Expr = body 'catch' '(' Name = name ')' Expr = handler 'end' { Try(l,body,name,handler) }.
PathExp ::= Atom = atom PathExp-Dis0 .
KeyArgs-Dis0-Star0 ::= ',' KeyArg = $head KeyArgs-Dis0-Star0 = $tail Cons | Nil .
Collect ::= '(' AName = v '|' Expr = e ')' { IterExp(c,n,v,e) }.
BindFunArgsTail-Star0 ::= ',' Pattern = $head BindFunArgsTail-Star0 = $tail Cons | Nil .
Expr ::= 'not' Expr = e { Negate(e) } | '-' SimpleExp = e { BinExp(IntExp(0),"-",e) } | Apply = a ExpTail .
SeqpTail ::= ',' Pattern = head SeqpTail = tail { Consp(head,tail) } | '}' { Constp(SetExp("Seq",Seq{})) }.
ArgsTail ::= ')' Seq{} | Expr = arg ArgsTail-Star0 = args ')' .
Varp-Dis1 ::= ':' TypeExp | { NamedType() }.
AtExp ::= LinePos = l '@' At = e { e.setLine(l) }.
ImportIn ::= 'import' ImportPath = path 'in' Exp = body 'end' { ImportIn(path,body) }.
EmptySeqTail ::= '}' { SetExp(l,"Seq",Seq{}) }.
Op ::= BinOp ! | ';' ; .
CollExp ::= SetExp ! | SeqExp ! .
Bindings ::= BindingList | Drop .
Pairp ::= 'Seq{' Pattern = head '|' Pattern = tail '}' { Consp(head,tail) }.
DropExpTail ::= DropOp = o ! DropExp = e { BinExp(a,o,e) } | .
KeyArgs ::= '[' KeyArgs-Dis0 .
BindFun ::= BindFunArgs = args OptType = type '=' SimpleExp = value { FunBinding(name,args,type,value) }.
SeqExp-Dis0 ::= EmptySeqTail | NonEmptySeqTail .
Apply ::= Atom = a ApplyTail = e Arrow .
Strp ::= Str = s { Constp(StrExp(s)) }.
FloatExp ::= LinePos = l Float = f { f.lift().line := l }.
CompilationUnit-Star1 ::= Import = $head CompilationUnit-Star1 = $tail Cons | Nil .
Consp ::= Pairp | Seqp | Emptyp .
EvaluationUnit-Star2 ::= EvaluationUnit-Star2-Dis0 = $head EvaluationUnit-Star2 = $tail Cons | Nil .
Patterns ::= Pattern = head Patterns-Star0 = tail | Seq{} .
TopLevelCommand ::= SimpleExp = c pState = p { p.consumeToken := false } ';' { resolve(order(c)) }.
Lift ::= LinePos = l '[|' Exp = e '|]' { Lift(l,e) }.
PathExp-Dis0-Star0 ::= '::' AName = $head PathExp-Dis0-Star0 = $tail Cons | Nil .
Objectp-Star0 ::= '::' Name = $head Objectp-Star0 = $tail Cons | Nil .
Keyp ::= Name = name '=' Pattern = pattern { Keyp(name,pattern) }.
TypePath ::= Name = name TypePath-Star0 = names { Seq{name | names}->collect(n |
Symbol(n)) }.
Pattern ::= AddPattern = p Pattern-Star0 = es { es->iterate(e s = p |
Includingp(s,e)) } = p PatternGuard .
ImportPath-Star0 ::= '::' Name = $head ImportPath-Star0 = $tail Cons | Nil .
CommaSepExps ::= Expr = e CommaSepExps-Star0 = es | Seq{} .
BindingList-Star0 ::= ';' Binding = $head BindingList-Star0 = $tail Cons | Nil .
ExpTail ::= Op = o ! Expr = e { BinExp(a,o,e) } | .
SimpleExp ::= 'not' SimpleExp = e { Negate(e) } | '-' SimpleExp = e { BinExp(IntExp(0),"-",e) } | Apply = a SimpleExpTail .
Args ::= '(' ArgsTail .
TypePath-Star0 ::= '::' Name = $head TypePath-Star0 = $tail Cons | Nil .
AtomicPattern ::= Varp | Constp | Objectp | Consp | Keywordp | Syntaxp | '(' Pattern ')' .
IntExp ::= LinePos = l Int = e { IntExp(l,e) }.
Emptyp ::= 'Seq{' '}' { Constp(SetExp("Seq",Seq{})) } | 'Set{' '}' { Constp(SetExp("Set",Seq{})) }.
OpType ::= TypeArgs = domains '->' TypeExp = range { OpType(domains,range) }.
Boolp ::= 'true' { Constp(BoolExp(true)) } | 'false' { Constp(BoolExp(false)) }.
BinOp ::= '<' < | '<=' <= | '>' > | '>=' >= | '<>' <> | '=' = | '::' :: | ':=' := | '.' . | 'and' and | 'andthen' andthen | 'implies' implies | 'or' or | 'orelse' orelse | '+' + | '-' - | '*' * | '/' / .
PairOrElements ::= '|' Expr = t '}' { ConsExp(e,t) } | PairOrElements-Star0 = es '}' { SetExp(l,"Seq",Seq{e | es}) }.
DropOp ::= '<' < | '<=' <= | '<>' <> | '=' = | '::' :: | ':=' := | '.' . | 'and' and | 'andthen' andthen | 'implies' implies | 'or' or | 'orelse' orelse | '+' + | '-' - | '*' * | '/' / .
Iterate ::= '(' AName = v1 AName = v2 '=' Expr = init '|' Expr = body ')' { Iterate(c,v1,v2,init,body) }.
BindingTail ::= BindFun | BindValue .
TypeExp-Dis0 ::= TypeArgs = args { ParametricType(path,args) } | { NamedType(path) }.
ApplyTail ::= Args = args ! { Apply(a,args) } | KeyArgs = args ! { Instantiate(a,args) } | .
StrExp ::= LinePos = l Str = e { StrExp(l,e) }.
Expp ::= '[' Exp = exp ']' { Constp(exp) }.
CompilationUnit-Star2 ::= CompilationBody = $head CompilationUnit-Star2 = $tail Cons | Nil .
CompilationBody ::= Def | TopLevelExp .
EvaluationUnit-Star1 ::= EImport = $head EvaluationUnit-Star1 = $tail Cons | Nil .
PatternTail ::= '->' Name '(' Pattern = p ')' .
TypeExp ::= TypePath = path TypeExp-Dis0 | Drop | OpType .
LetExp ::= LinePos = l 'let' Bindings = bindings LetBody = body 'end' { Let(l,bindings,body) }.
ParserImport-Star0 ::= '::' Name = $head ParserImport-Star0 = $tail Cons | Nil .
PairOrElements-Star0 ::= ',' Expr = $head PairOrElements-Star0 = $tail Cons | Nil .
LetBody ::= 'in' Expr = body | 'then' Bindings = bindings LetBody = body { Let(bindings,body) }.
TypeArgs ::= '(' TypeExp = arg TypeArgs-Star0 = args ')' .
PatternGuard ::= 'when' Exp = e { Condp(p,e) } | .
EvaluationUnit-Star0 ::= ParserImport = $head EvaluationUnit-Star0 = $tail Cons | Nil .
CompilationUnit ::= CompilationUnit-Star0 CompilationUnit-Star1 = imports CompilationUnit-Star2 = exps EOF pState = s { CompilationUnit("",imports,exps,s.getSource()) }.
CommaSepExps-Star0 ::= ',' Expr = $head CommaSepExps-Star0 = $tail Cons | Nil .
Exp1 ::= Exp EOF .
SimpleExpTail ::= BinOp = o ! SimpleExp = e { BinExp(a,o,e) } | .
Arrow ::= '->' ! ArrowTail | .
TypeArgs-Star0 ::= ',' TypeExp = $head TypeArgs-Star0 = $tail Cons | Nil .
Binding ::= AName = name BindingTail .
Intp ::= Int = i { Constp(IntExp(i)) }.
EImport ::= 'import' TopLevelExp = exp { Evaluator::Import(exp) }.
OptType ::= ':' TypeExp | { NamedType() }.
BoolExp ::= LinePos = l 'true' { BoolExp(l,true) } | LinePos = l 'false' { BoolExp(l,false) }.
|