Add the tiger source code bundle from the book site
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
915660c8a7
commit
33d8bac511
87 changed files with 3252 additions and 0 deletions
40
tiger/chap4/tiger.grm
Normal file
40
tiger/chap4/tiger.grm
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
structure A = Absyn
|
||||
|
||||
%%
|
||||
%term
|
||||
EOF
|
||||
| ID of string
|
||||
| INT of int | STRING of string
|
||||
| COMMA | COLON | SEMICOLON | LPAREN | RPAREN | LBRACK | RBRACK
|
||||
| LBRACE | RBRACE | DOT
|
||||
| PLUS | MINUS | TIMES | DIVIDE | EQ | NEQ | LT | LE | GT | GE
|
||||
| AND | OR | ASSIGN
|
||||
| ARRAY | IF | THEN | ELSE | WHILE | FOR | TO | DO | LET | IN | END | OF
|
||||
| BREAK | NIL
|
||||
| FUNCTION | VAR | TYPE
|
||||
|
||||
%nonterm exp | program of A.exp
|
||||
|
||||
%pos int
|
||||
%verbose
|
||||
%start program
|
||||
%eop EOF
|
||||
%noshift EOF
|
||||
|
||||
%name Tiger
|
||||
|
||||
%keyword WHILE FOR TO BREAK LET IN END FUNCTION VAR TYPE ARRAY IF THEN ELSE
|
||||
DO OF NIL
|
||||
|
||||
%prefer THEN ELSE LPAREN
|
||||
|
||||
%value ID ("bogus")
|
||||
%value INT (1)
|
||||
%value STRING ("")
|
||||
|
||||
%%
|
||||
|
||||
program : exp (exp)
|
||||
|
||||
|
||||
exp: NIL (A.NilExp)
|
||||
Loading…
Add table
Add a link
Reference in a new issue