-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.ml
35 lines (32 loc) · 1.04 KB
/
list.ml
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
open turtle;;
let list = (cmd:exprnode) (state:state2d ref) =
ignore state;
match cmd with
| Multiply _ -> printf "Mult "
| Add _ -> printf "Add "
| Divide _ -> printf "Div "
| Subtract _ -> printf "Sub "
| Forward _ -> printf "Forward "
| Backward _ -> printf "Backward "
| TurnRight _ -> printf "TurnRight "
| TurnLeft _ -> printf "TurnLeft "
| PenDown -> printf "PenDown "
| Block _ -> printf "Block "
| Operator _ -> printf "Op "
| Condition _ -> printf "Cond "
| If _ -> printf "If "
| Repeat _ -> printf "Repeat "
| Proc _ -> printf "Proc "
| Call _ -> printf "Call "
| Print Num n -> printf "-------------> %d\n" n
| Print _ -> printf "Print "
| Num _ -> printf "Num "
| Stop -> printf "Stop "
| Var _ -> printf "Lookup \n"
| Param _ -> printf "Param\n"
| _ -> printf "Other "
and listall program st =
match program with
| [] -> printf "END PROG.\n"; flush stdout
| stmt::rest -> list stmt st;
listall rest st