3 * Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu>
4 * Modified: Alex Vaynberg <alv@andrew.cmu.edu>
5 * Modified: Frank Pfenning <fp@cs.cmu.edu>
11 datatype binop = ADD | SUB | MUL | DIV | MOD
16 | BINOP of binop * exp * exp
21 type program = stm list
25 val pp_exp : exp -> string
26 val pp_stm : stm -> string
27 val pp_program : program -> string
31 structure Tree :> TREE =
34 datatype binop = ADD | SUB | MUL | DIV | MOD
39 | BINOP of binop * exp * exp
44 type program = stm list
49 fun pp_binop ADD = "+"
55 fun pp_exp (CONST(x)) = Word32Signed.toString x
56 | pp_exp (TEMP(t)) = Temp.name t
57 | pp_exp (BINOP (binop, e1, e2)) =
58 "(" ^ pp_exp e1 ^ " " ^ pp_binop binop ^ " " ^ pp_exp e2 ^ ")"
60 fun pp_stm (MOVE (e1,e2)) =
61 pp_exp e1 ^ " <-- " ^ pp_exp e2
65 fun pp_program (nil) = ""
66 | pp_program (stm::stms) = pp_stm stm ^ "\n" ^ pp_program stms