Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: toy/fl/concrete/dcg/extracted
Source used for this grammar: Ralf Lämmel, Parser.pro
, 28 July – 3 September 2008 [GitHub]
program
, function
, expr
, atom
, ops
), 0 root (—), 1 top (program
), 3 bottom (newline
, int
, name
4).[binary]
, [apply]
, [ifThenElse]
, [literal]
, [argument]
, [equal]
, [plus]
, [minus]
.program ::=
function
function ::= name name"=" expr newline
expr ::= [binary]::atom ops atom
expr ::= [apply]::name atom
expr ::= [ifThenElse]::"if" expr "then" expr "else" expr
atom ::= [literal]::int
atom ::= [argument]::name
atom ::= "(" expr ")"
ops ::=
[equal]::"=="
ops ::=
[plus]::"+"
ops ::=
[minus]::"-"