Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: toy/fl/concrete/rascal/extracted
Source used for this grammar: Vadim Zaytsev, Concrete.rsc
, Feb–Jun 2012 [GitHub]
Program
, Expr
, Ops
, Function
), 0 root (—), 1 top (Program
), 2 bottom (Int
, Name
4).[functions]
, [prg]
, [cond]
, [thenbranch]
, [elsebranch]
, [ifThenElse]
, [e]
, [i]
, [literal]
, [a]
, [argument]
, [lexpr]
, [op]
, [rexpr]
, [binary]
, [f]
2, [vargs]
, [apply]
, [plus]
, [equal]
, [minus]
, [args]
, [body]
, [fun]
.Program ::= [prg]::[functions]::"\n"Function
Expr ::= [ifThenElse]::"if" [cond]::Expr "then" [thenbranch]::Expr "else" [elsebranch]::Expr
Expr ::= "(" [e]::Expr ")"
Expr ::= [literal]::[i]::Int
Expr ::= [argument]::[a]::Name
Expr ::= [binary]::[lexpr]::Expr [op]::Ops [rexpr]::Expr
Expr ::= [apply]::[f]::Name [vargs]::Expr
Ops ::=
[plus]::"+"
Ops ::=
[equal]::"=="
Ops ::=
[minus]::"-"
Function ::= [fun]::"=" [body]::Expr[f]::Name [args]::Name