tree.sig 1.28 KB
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