Module Desugaring.Desugared_ast
type identifier
=
|
Variable of Ast.Ast_types.type_expr * Ast.Ast_types.Var_name.t * Ast.Ast_types.capability list * Ast.Ast_types.borrowed_ref option
|
ObjField of Ast.Ast_types.Class_name.t * Ast.Ast_types.Var_name.t * Ast.Ast_types.type_expr * Ast.Ast_types.Field_name.t * Ast.Ast_types.capability list * Ast.Ast_types.borrowed_ref option
class of the object, type of field
capabilities and modes are associated with this identifier
val string_of_id : identifier -> string
type obj_var_and_capabilities
= Ast.Ast_types.Var_name.t * Ast.Ast_types.Class_name.t * Ast.Ast_types.capability list
an object variable and associated types and capabilities
type expr
=
|
Integer of Ast.Ast_types.loc * int
no need for type_expr annotation as obviously TEInt
|
Boolean of Ast.Ast_types.loc * bool
no need for type_expr annotation as obviously TEBool
|
Identifier of Ast.Ast_types.loc * identifier
Type information associated with identifier
|
BlockExpr of Ast.Ast_types.loc * block_expr
used to interconvert with block expr
|
Constructor of Ast.Ast_types.loc * Ast.Ast_types.type_expr * Ast.Ast_types.Class_name.t * constructor_arg list
|
Let of Ast.Ast_types.loc * Ast.Ast_types.type_expr * Ast.Ast_types.Var_name.t * expr
|
Assign of Ast.Ast_types.loc * Ast.Ast_types.type_expr * identifier * expr
|
Consume of Ast.Ast_types.loc * identifier
Type is associated with the identifier
|
MethodApp of Ast.Ast_types.loc * Ast.Ast_types.type_expr * Ast.Ast_types.Var_name.t * Ast.Ast_types.capability list * Ast.Ast_types.Class_name.t * Ast.Ast_types.Method_name.t * expr list
we track the allowed capabilities of the variable calling the method
|
FunctionApp of Ast.Ast_types.loc * Ast.Ast_types.type_expr * Ast.Ast_types.Function_name.t * expr list
|
Printf of Ast.Ast_types.loc * string * expr list
no need for type_expr annotation as obviously TEVoid
|
FinishAsync of Ast.Ast_types.loc * Ast.Ast_types.type_expr * async_expr list * obj_var_and_capabilities list * block_expr
overall type is that of the expr on the current thread - since forked exprs' values are ignored.
obj_var_and_capabilities list
is a list of free object variables in the block expression and their associated types and capabilities|
If of Ast.Ast_types.loc * Ast.Ast_types.type_expr * expr * block_expr * block_expr
If ___ then ___ else ___ - type is that of the branch exprs
|
While of Ast.Ast_types.loc * expr * block_expr
While ___ do ___ ; - no need for type_expr annotation as type of a loop is TEVoid
|
BinOp of Ast.Ast_types.loc * Ast.Ast_types.type_expr * Ast.Ast_types.bin_op * expr * expr
|
UnOp of Ast.Ast_types.loc * Ast.Ast_types.type_expr * Ast.Ast_types.un_op * expr
and block_expr
=
|
Block of Ast.Ast_types.loc * Ast.Ast_types.type_expr * expr list
type is of the final expr in block
and constructor_arg
=
|
ConstructorArg of Ast.Ast_types.type_expr * Ast.Ast_types.Field_name.t * expr
Constructor arg consists of a field and the expression being assigned to it (annotated with the type of the expression)
and async_expr
=
|
AsyncExpr of obj_var_and_capabilities list * block_expr
Async exprs have a precomputed list of their free object variables and their associated classes and capabilities.
type function_defn
=
|
TFunction of Ast.Ast_types.Function_name.t * Ast.Ast_types.borrowed_ref option * Ast.Ast_types.type_expr * Ast.Ast_types.param list * block_expr
Function defn consists of the function name, return type (and whether it returns a borrowed ref), the list of params, and the body expr of the function
type method_defn
=
|
TMethod of Ast.Ast_types.Method_name.t * Ast.Ast_types.borrowed_ref option * Ast.Ast_types.type_expr * Ast.Ast_types.param list * Ast.Ast_types.capability list * block_expr
Method defn consists the method name, return type (and whether it returns a borrowed ref), the list of params, the capabilities used and the body expr of the function
type class_defn
=
|
TClass of Ast.Ast_types.Class_name.t * Ast.Ast_types.Class_name.t option * Ast.Ast_types.capability list * Ast.Ast_types.field_defn list * method_defn list
Class definitions consist of the class name and optionally if it inherits from another class, its capabilities and the fields and methods in the class
type program
=
|
Prog of class_defn list * function_defn list * block_expr
Each bolt program defines the classes,followed by functions, followed by the main expression block to execute.