]> Joshua Wise's Git repositories - snipe.git/blob - trans/tree.sml
Add strings to the IR
[snipe.git] / trans / tree.sml
1 (* L3 Compiler
2  * IR Trees
3  * Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
4  * Modified: Alex Vaynberg <alv@andrew.cmu.edu>
5  * Modified: Frank Pfenning <fp@cs.cmu.edu>
6  * Modified: Joshua Wise <jwise>
7  * Modified: Chris Lu <czl>
8  *)
9
10 signature TREE =
11 sig
12   datatype binop = ADD | SUB | MUL | DIV | MOD | LSH | RSH | LOGOR | LOGAND | BITOR | BITAND | BITXOR | NEQ | EQ | LT | GT | LE | GE | BE
13   datatype unop = NEG | BITNOT | BANG
14
15   type Blarg = int
16
17   datatype exp = 
18       CONST of Word32.word
19     | TEMP of Temp.temp
20     | ARG of Blarg (* I am j4cbo *)
21     | BINOP of binop * exp * exp
22     | UNOP of unop * exp
23     | CALL of Ast.ident * exp list
24     | MEMORY of exp
25     | ALLOC of exp
26     | STRING of Stringref.stringref
27     | COND of exp * exp * exp
28     | STMVAR of stm list * exp
29     | NULLPTR
30   and stm =
31       MOVE of exp * exp
32     | RETURN of exp
33     | EFFECT of exp
34     | LABEL of Label.label
35     | JUMPIFN of exp * Label.label
36     | JUMP of Label.label
37   and func =
38       FUNCTION of Ast.ident * stm list
39
40   type program = func list
41 end
42
43 structure Tree :> TREE =
44 struct
45   datatype binop = ADD | SUB | MUL | DIV | MOD | LSH | RSH | LOGOR | LOGAND | BITOR | BITAND | BITXOR | NEQ | EQ | LT | GT | LE | GE | BE
46   datatype unop = NEG | BITNOT | BANG
47
48   type Blarg = int
49
50   datatype exp = 
51       CONST of Word32.word
52     | TEMP of Temp.temp
53     | ARG of Blarg (* I am j4cbo *)
54     | BINOP of binop * exp * exp
55     | UNOP of unop * exp
56     | CALL of Ast.ident * exp list
57     | MEMORY of exp
58     | ALLOC of exp
59     | STRING of Stringref.stringref
60     | COND of exp * exp * exp
61     | STMVAR of stm list * exp
62     | NULLPTR
63   and stm =
64       MOVE of exp * exp
65     | RETURN of exp
66     | EFFECT of exp
67     | LABEL of Label.label
68     | JUMPIFN of exp * Label.label
69     | JUMP of Label.label
70   and func =
71       FUNCTION of Ast.ident * stm list
72
73   type program = func list
74 end
This page took 0.023119 seconds and 4 git commands to generate.