-
Notifications
You must be signed in to change notification settings - Fork 0
/
oldGrammar.txt
45 lines (37 loc) · 1.26 KB
/
oldGrammar.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Program ::= varName '(' ')' '{' Stmts '}' //root
Stmts ::= <<empty>>
Stmts ::= Stmt Stmts
Stmt ::= Decl
Stmt ::= '{' Stmts '}'
Stmt ::= 'if' '(' Expr ')' Stmt
Stmt ::= 'if' '(' Expr ')' Stmt 'else' Stmt
Stmt ::= varName '=' Expr ';' | varName '[' Expr ':' Expr ']' '=' Expr ';'
Stmt ::= 'print' '(' Expr ')' ';'
Stmt ::= 'repeat' '(' varName '=' Expr 'to' Expr ')' Stmt
Stmt ::= ';'
Decl ::= 'int' varName ';'
Decl ::= 'float' varName ';'
Decl ::= 'string' varName ';'
Decl ::= 'matrix' varName '[' Expr ':' Expr ']' varName ':' varName '=' Expr ';'
Decl ::= 'matrix' varName '=' Expr ';'
Expr ::= varName
Expr ::= integerConst | floatConst | stringConst
Expr ::= 'true' | 'false'
Expr ::= Expr '*' Expr
Expr ::= Expr '/' Expr
Expr ::= Expr '+' Expr
Expr ::= Expr '-' Expr
Expr ::= Expr '>' Expr
Expr ::= Expr '>=' Expr
Expr ::= Expr '<' Expr
Expr ::= Expr '<=' Expr
Expr ::= Expr '==' Expr
Expr ::= Expr '!=' Expr
Expr ::= Expr '&&' Expr
Expr ::= Expr '||' Expr
Expr ::= varName '[' Expr ':' Expr ']' //MatrixREf
Expr ::= varName '(' Expr ')' //NestedOrFunctionCall
Expr ::= '(' Expr ')'
Expr ::= 'let' Stmts 'in' Expr 'end' //LetExpr
Expr ::= 'if' Expr 'then' Expr 'else' Expr //IfExpr
Expr ::= '!' Expr //NotExpr