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
20
tiger/chap1/slp.sml
Normal file
20
tiger/chap1/slp.sml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
type id = string
|
||||
|
||||
datatype binop = Plus | Minus | Times | Div
|
||||
|
||||
datatype stm = CompoundStm of stm * stm
|
||||
| AssignStm of id * exp
|
||||
| PrintStm of exp list
|
||||
|
||||
and exp = IdExp of id
|
||||
| NumExp of int
|
||||
| OpExp of exp * binop * exp
|
||||
| EseqExp of stm * exp
|
||||
val prog =
|
||||
CompoundStm(AssignStm("a",OpExp(NumExp 5, Plus, NumExp 3)),
|
||||
CompoundStm(AssignStm("b",
|
||||
EseqExp(PrintStm[IdExp"a",OpExp(IdExp"a", Minus,NumExp 1)],
|
||||
OpExp(NumExp 10, Times, IdExp"a"))),
|
||||
PrintStm[IdExp "b"]))
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue