ca25bb06f261464a51401135f1ea31eb6e292859
[cc1516.git] / src / grammar.txt
1 <Expr> ::= <id> ['hd'|'tl'|'fst'|'snd] <Expr`>
2 | <Op1> <Expr> <Expr`>
3 | <int> <Expr`>
4 | <char> <Expr`>
5 | 'False' <Expr`>
6 | 'True' <Expr`>
7 | '(' <Expr> ')' <Expr`>
8 | <id> '(' [<ActArgs>] ')' <Expr`>
9 | '[]' <Expr> <Expr`>
10 | '(' <Expr> ',' <Expr> ')' <Expr`>
11 <Expr`> ::= <Op2> <Expr> <Expr`> | e
12 <Op2> ::= '+' | '-' | '*' | '/' | '%' | '==' | '<' | '>' | '<=' | '>='
13 | '!=' | '&&' | '||' | ':'
14
15 <ActArgs> ::= <Expr> [',' ActArgs]
16
17 <VarDecl> ::= (<Type> | 'var') <id> '=' <Expr> ';'
18
19 <Type> ::= 'Int'
20 | 'Bool'
21 | 'Char'
22 | '(' Type ',' Type ')'
23 | '[' Type ']'
24 | <id>