part of the grammar
authorMart Lubbers <mart@martlubbers.net>
Sat, 27 Feb 2016 13:23:23 +0000 (14:23 +0100)
committerMart Lubbers <mart@martlubbers.net>
Sat, 27 Feb 2016 13:23:23 +0000 (14:23 +0100)
src/grammar.txt [new file with mode: 0644]

diff --git a/src/grammar.txt b/src/grammar.txt
new file mode 100644 (file)
index 0000000..ca25bb0
--- /dev/null
@@ -0,0 +1,24 @@
+<Expr>    ::= <id> ['hd'|'tl'|'fst'|'snd] <Expr`>
+                 | <Op1> <Expr> <Expr`>
+                 | <int> <Expr`>
+                 | <char> <Expr`>
+                 | 'False' <Expr`>
+                 | 'True' <Expr`>
+                 | '(' <Expr> ')' <Expr`>
+                 | <id> '(' [<ActArgs>] ')' <Expr`>
+                 | '[]' <Expr> <Expr`>
+                 | '(' <Expr> ',' <Expr> ')' <Expr`>
+<Expr`>   ::= <Op2> <Expr> <Expr`> | e
+<Op2>     ::= '+' | '-' | '*' | '/' | '%' | '==' | '<' | '>' | '<=' | '>='
+          |    '!=' | '&&' | '||' | ':'
+
+<ActArgs> ::= <Expr> [',' ActArgs]
+
+<VarDecl> ::= (<Type> | 'var') <id> '=' <Expr> ';'
+
+<Type> ::= 'Int'
+       | 'Bool'
+       | 'Char'
+       | '(' Type ',' Type ')'
+       | '[' Type ']'
+       | <id>