Blame view

src/SML/tree.sig 1.28 KB
Ulrich Schoepp committed
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
signature TREE = sig

datatype binop = Plus
               | Minus
               | Mul
               | Div
               | And
               | Or
               | LShift
               | RShift
               | ARShift
               | Xor

datatype relop = EQ
               | NE
               | LT
               | GT
               | LE
               | GE
               | ULT
               | ULE
               | UGT
               | UGE

datatype exp = Const of Int32.int
             | Name of Label.t
             | Temp of Temp.t
             | Param of int
             | Mem of exp
             | BinOp of binop * exp * exp
             | Call of exp * exp list
             | ESeq of stm list * exp
and stm = Move of exp * exp
        | Jump of exp * Label.t list
        | CJump of relop * exp * exp * Label.t * Label.t
        | Seq of stm list
        | Label of Label.t

type func = {
  name: Label.t,
  nparams: int,
  body: stm list,
  ret: Temp.t
}

type prg = {
  funcs: func list
}

val output_binop: TextIO.outstream -> binop -> unit
val output_relop: TextIO.outstream -> relop -> unit
val output_exp: TextIO.outstream -> exp -> unit
val output_stm: TextIO.outstream -> stm -> unit
val output_func: TextIO.outstream -> func -> unit
val output_prg: TextIO.outstream -> prg -> unit

end