Perk.CodegenGenerates C code given a parsed Perk program.
val lambdas_hashmap :
(Ast.expr_a, string * string * string list * string) Stdlib.Hashtbl.ttable of lambdas: Lambda expression, identifier, generated code, capture list, type_descriptor
val fundecl_symbol_table : (Ast.perkident, Ast.perktype) Stdlib.Hashtbl.tSymbol table of function declarations
val archetype_hashtable :
(string, (string, Ast.perktype) Stdlib.Hashtbl.t) Stdlib.Hashtbl.thashtable of archetypes
val add_archetype : string -> (string, Ast.perktype) Stdlib.Hashtbl.tAdds a new archetype with name name to the archetype hastable
val get_archetype : string -> (string, Ast.perktype) Stdlib.Hashtbl.tval add_binding_to_archetype : string -> Ast.perkident -> Ast.perktype -> unitadds the binding (id, typ) to archetype with name name
val codegen_functional : is_lambda:bool -> Ast.expr_a -> stringcodegens a function or a lambda
val bind_function_type : Ast.perkident -> Ast.perktype -> unitBinds a function type to the fundecl_symbol_table.
val codegen_program : Ast.topleveldef_a list -> stringTransforms a perk program into a string containing the corresponding C program.
val codegen_topleveldef : Ast.topleveldef_a -> stringGenerates code for a top level definition.
val codegen_command : Ast.command_a -> int -> stringGenerates code for perk commands.
val codegen_def :
Ast.perkvardesc ->
Ast.expr_a ->
Ast.perktype option ->
string ->
stringGenerates code for perk definitions.
val codegen_decl : Ast.perkvardesc -> stringGenerates code for perk declaration.
val codegen_fundef :
Ast.perktype ->
Ast.perkident ->
Ast.perkvardesc list ->
Ast.command_a ->
stringGenerates code for perk function definitions.
val codegen_type : ?expand:bool -> Ast.perktype -> stringtransforms a perktype into a C type
val codegen_attr : Ast.perktype_attribute -> stringCodegens perk attributes.
val codegen_qual : Ast.perktype_qualifier -> stringCodegens perk qualifiers.
val codegen_expr_and_letindefs : Ast.expr_a -> string * stringCodegens perk expressions (first output string), also returning the code that declares the fresh variables used in generating let...in-like expressions (second output string).
val codegen_expr : Ast.expr_a -> stringCodegen expressions.
val codegen_binop : Ast.binop -> stringgenerates code for binary operators
val codegen_preunop : Ast.preunop -> stringgenerates code for prefix unary operators
val codegen_postunop : Ast.postunop -> stringgenerates code for postfix unary operators
val codegen_fundecl : Ast.perkident -> Ast.perktype -> stringgenerates code for function declarations
val codegen_type_definition : Ast.perktype -> stringGenerates code for type definitions.
val codegen_lambda_environment : Ast.perkvardesc list -> bool * string * stringval codegen_lambda_capture : Ast.perktype -> string