Szintaxis BNF-ben
<Permutation> := `(' <Expr> {`,' <Expr> } `)' { `(' <Expr> {`,' <Expr> } `)' }
<Ident> := `a'|...|`z'|`A'|...|`Z'|`_' {`a'|...|`z'|`A'|...|`Z'|`0'|...|`9'|`_'}
<Var> := <Ident>
| <Var> `.' <Ident>
| <Var> `.' `(' <Expr> `)'
| <Var> `['<Expr>`]'
| <Var> `{ <Expr> }'
| <Var> `(' [ <Expr> { ,<Expr> } ] `)'
| <Var> `!.`<Ident>
| <Var> `!.' `(' <Expr> `)'
| <Var> `![' <Expr> `]'
<List> := `[' [ <Expr> ] {`,' [ <Expr> ] } `]'
| `[' <Expr> [, <Expr> ] `..' <Expr>`]'
| <List> `' <List> `'
<Record> := `rec(' [ <Ident> `:=' <Expr> {`,' <Ident> `:=' <Expr> } ] `)'
<Permutation> := `(' <Expr> {`,' <Expr> } `)' { `(' <Expr> {`,' <Expr> } `)' }
<Function> := `function (' [ <Ident> {`,' <Ident> } ] `)'
[ `local' <Ident> {`,' <Ident> } `;' ]
<Statements>
`end'
| <Ident> `->' <Expr>
<Char> := '<any character> '
<String> := `"' { <any character> } `"'
<Int> := `0'|`1'|...|`9' {`0'|`1'|...|`9'}
<Atom> := <Int>
| <Var>
| `(' <Expr> `)'
| <Permutation>
| <Char>
| <String>
| <Function>
| <List>
| <Record>
| { `not' } `true'
| { `not' } `false'
<Factor> := {`+'|`-'} <Atom> [ `^' {`+'|`-'} <Atom> ]
<Term> := <Factor> { `*'|`/'|`mod' <Factor> }
<Arith> := <Term> { `+'|`-' <Term> }
<Rel> := { `not' } <Arith> [ `='|`\<>'|`\<'|`>'|`\<='|`>='|`in' <Arith> ]
<And> := <Rel> { `and' <Rel> }
<Logical> := <And> { `or' <And> }
<Expr> := <Logical>
| <Var>
<Statement> := <Expr>
| <Var> `:=' <Expr>
| `if' <Expr> `then' <Statements>
{ `elif' <Expr> `then' <Statements> }
[ `else'<Statements> ] `fi'
| \hspace{1cm}`for' <Var> `in' <Expr> `do' <Statements> `od'
| `while' <Expr> `do' <Statements> `od'
| `repeat' <Statements> `until' <Expr>
| `return' [ <Expr> ]
| `break'
| `quit'
| `QUIT'
|
<Statements> := { <Statement> `;' }
| `;'
|