sig
type refine_switch =
Switch of string * (string * string) list * string
| Test of string * string list * string
type varkind = Instance of string | Local
type environment = (string * Sast.varkind) Map.Make(String).t
type funcid = BuiltIn of string | FuncId of string | ArrayAlloc of string
type expr_detail =
This
| Null
| Id of string
| NewObj of string * Sast.expr list * Sast.funcid
| Anonymous of string * Sast.expr list * Ast.func_def list
| Literal of Ast.lit
| Assign of Sast.expr * Sast.expr
| Deref of Sast.expr * Sast.expr
| Field of Sast.expr * string
| Invoc of Sast.expr * string * Sast.expr list * Sast.funcid
| Unop of Ast.op * Sast.expr
| Binop of Sast.expr * Ast.op * Sast.expr
| Refine of string * Sast.expr list * string option * Sast.refine_switch
| Refinable of string * Sast.refine_switch
and expr = string * Sast.expr_detail
and sstmt =
Decl of Ast.var_def * Sast.expr option * Sast.environment
| If of (Sast.expr option * Sast.sstmt list) list * Sast.environment
| While of Sast.expr * Sast.sstmt list * Sast.environment
| Expr of Sast.expr * Sast.environment
| Return of Sast.expr option * Sast.environment
| Super of Sast.expr list * string * string * Sast.environment
and func_def = {
returns : string option;
host : string option;
name : string;
static : bool;
formals : Ast.var_def list;
body : Sast.sstmt list;
section : Ast.class_section;
inklass : string;
uid : string;
builtin : bool;
}
type member_def =
VarMem of Ast.var_def
| MethodMem of Sast.func_def
| InitMem of Sast.func_def
type class_sections_def = {
privates : Sast.member_def list;
protects : Sast.member_def list;
publics : Sast.member_def list;
refines : Sast.func_def list;
mains : Sast.func_def list;
}
type class_def = {
klass : string;
parent : string option;
sections : Sast.class_sections_def;
}
type program = Sast.class_def list
end