Module Sast

module Sast: sig .. end
Types for the semantic abstract syntax tree

type refine_switch = 
| Switch of string * (string * string) list * string
| Test of string * string list * string
A switch for refinment or refinable checks
type varkind = 
| Instance of string
| Local
The type of a variable in the environment
type environment = (string * varkind) Map.Make(String).t 
The environment at any given statement.
type funcid = 
| BuiltIn of string
| FuncId of string
| ArrayAlloc of string
The ID can be built in (and so won't get mangled) or an array allocator.
type expr_detail = 
| This
| Null
| Id of string
| NewObj of string * expr list * funcid
| Anonymous of string * expr list * Ast.func_def list
| Literal of Ast.lit
| Assign of expr * expr
| Deref of expr * expr
| Field of expr * string
| Invoc of expr * string * expr list * funcid
| Unop of Ast.op * expr
| Binop of expr * Ast.op * expr
| Refine of string * expr list * string option * refine_switch
| Refinable of string * refine_switch
An expression value -- like in AST
type expr = string * expr_detail 
An expression with a type tag
type sstmt = 
| Decl of Ast.var_def * expr option * environment
| If of (expr option * sstmt list) list * environment
| While of expr * sstmt list * environment
| Expr of expr * environment
| Return of expr option * environment
| Super of expr list * string * string * environment (*arglist, uidof super init, superclass, env**)
A statement tagged with an environment
type func_def = {
   returns : string option;
   host : string option;
   name : string;
   static : bool;
   formals : Ast.var_def list;
   body : sstmt list;
   section : Ast.class_section;
   inklass : string;
   uid : string;
   builtin : bool;
}
A function definition
type member_def = 
| VarMem of Ast.var_def
| MethodMem of func_def
| InitMem of func_def
type class_sections_def = {
   privates : member_def list;
   protects : member_def list;
   publics : member_def list;
   refines : func_def list;
   mains : func_def list;
}
type class_def = {
   klass : string;
   parent : string option;
   sections : class_sections_def;
}
type program = class_def list