Source

SmallCC / src / ast.mli

type typeid =
     Id of string

type  value = 
    String of string
    (* "sting" *)
  | Int of int
    (* int *)
  | Lvalue of string
    (* sting *)
  | Op of ops
    (* ops *)
  | VExp of exp

and ops =
    MUL of value * value
    (* value * value *)
  | DIV of value * value 
    (* value / value *)
  | PLUS of value * value 
    (* value + value *)
  | MOIN of value * value 
    (* value - value *)


and arg =
    Arg of value * arg
  (* value [, value] *)
  | ArgNone

and argfield =
    ArgField of typeid * string * argfield
  (* value [, value] *)
  | ArgFieldNone

and exp =
    Call of string *  arg
  (* string (arg); *)
  | Assign of string * value
  (* string = value; *)
  | Return of value
  (* return value; *)

type dec =
    Variable of typeid * string * value    
  (* typeid string = name; *)
  | Function of typeid * string *  argfield * programme
  (* typeid string (arg) { programme }*)

and programme =
    Dec of dec * programme
  | Exp of exp * programme
  | None