Module Ir_gen.Frontend_ir
val un_op_from_protobuf_bare : Protobuf.Decoder.t -> un_op
val un_op_to_protobuf_bare : un_op -> Protobuf.Encoder.t -> unit
val un_op_from_protobuf : Protobuf.Decoder.t -> un_op
val un_op_to_protobuf : un_op -> Protobuf.Encoder.t -> unit
val string_of_un_op : un_op -> string
type bin_op
=
|
BinOpPlus
|
BinOpMinus
|
BinOpMult
|
BinOpIntDiv
|
BinOpRem
|
BinOpLessThan
|
BinOpLessThanEq
|
BinOpGreaterThan
|
BinOpGreaterThanEq
|
BinOpAnd
|
BinOpOr
|
BinOpEq
|
BinOpNotEq
val bin_op_from_protobuf_bare : Protobuf.Decoder.t -> bin_op
val bin_op_to_protobuf_bare : bin_op -> Protobuf.Encoder.t -> unit
val bin_op_from_protobuf : Protobuf.Decoder.t -> bin_op
val bin_op_to_protobuf : bin_op -> Protobuf.Encoder.t -> unit
val string_of_bin_op : bin_op -> string
val type_expr_from_protobuf : Protobuf.Decoder.t -> type_expr
val type_expr_to_protobuf : type_expr -> Protobuf.Encoder.t -> unit
val string_of_type : type_expr -> string
type param
=
|
TParam of type_expr * string
val param_from_protobuf : Protobuf.Decoder.t -> param
val param_to_protobuf : param -> Protobuf.Encoder.t -> unit
type identifier
=
|
Variable of string
|
ObjField of string * int
object name, field = index into class field types list
val identifier_from_protobuf : Protobuf.Decoder.t -> identifier
val identifier_to_protobuf : identifier -> Protobuf.Encoder.t -> unit
val lock_type_from_protobuf_bare : Protobuf.Decoder.t -> lock_type
val lock_type_to_protobuf_bare : lock_type -> Protobuf.Encoder.t -> unit
val lock_type_from_protobuf : Protobuf.Decoder.t -> lock_type
val lock_type_to_protobuf : lock_type -> Protobuf.Encoder.t -> unit
val string_of_lock_type : lock_type -> string
type expr
=
|
Integer of int
|
Boolean of bool
|
Identifier of identifier * lock_type option
|
Constructor of string * constructor_arg list
|
Let of string * expr
|
Assign of identifier * expr * lock_type option
|
Consume of identifier * lock_type option
|
FunctionApp of string * expr list
|
MethodApp of string * string * int * expr list
object name, static method name (used to get method arg types), method index into vtable, args
|
Printf of string * expr list
|
FinishAsync of async_expr list * expr list
|
IfElse of expr * expr list * expr list
If ___ then ___ else ___
|
WhileLoop of expr * expr list
While ___ do ___ ;
|
BinOp of bin_op * expr * expr
|
UnOp of un_op * expr
|
Block of block_expr
|
Lock of string * lock_type
|
Unlock of string * lock_type
and block_expr
= expr list
and async_expr
=
|
AsyncExpr of string list * block_expr
Async exprs have a precomputed list of their free variables (passed as arguments when they are spawned as thread)
and constructor_arg
=
|
ConstructorArg of int * expr
int
=field_index,expr
= assigned value
val expr_from_protobuf : Protobuf.Decoder.t -> expr
val expr_to_protobuf : expr -> Protobuf.Encoder.t -> unit
val block_expr_from_protobuf : Protobuf.Decoder.t -> block_expr
val block_expr_to_protobuf : block_expr -> Protobuf.Encoder.t -> unit
val async_expr_from_protobuf : Protobuf.Decoder.t -> async_expr
val async_expr_to_protobuf : async_expr -> Protobuf.Encoder.t -> unit
val constructor_arg_from_protobuf : Protobuf.Decoder.t -> constructor_arg
val constructor_arg_to_protobuf : constructor_arg -> Protobuf.Encoder.t -> unit
type function_defn
=
|
TFunction of string * type_expr * param list * expr list
Function defn consists of the function name, return type, the list of params, and the body expr block of the function
val function_defn_from_protobuf : Protobuf.Decoder.t -> function_defn
val function_defn_to_protobuf : function_defn -> Protobuf.Encoder.t -> unit
type class_defn
=
|
TClass of string * type_expr list * string list
Class definitions consist of the class name, the list of the types of its fields and a vtable. Its methods are now plain old functions
val class_defn_from_protobuf : Protobuf.Decoder.t -> class_defn
val class_defn_to_protobuf : class_defn -> Protobuf.Encoder.t -> unit
type program
=
|
Prog of class_defn list * function_defn list * expr list
Each bolt program defines the classes,followed by functions, followed by the main expression block to execute.