Module Perk.Utils

Various utilities.

val fnm : string Stdlib.ref

Filename of the current perk file being processed

val static_compilation : bool

Internal flag to denote whether the current compilation mode is static

val say_here : string -> unit

Debug function that can be enabled to track function call numbers.

val add_parameter_to_func : Ast.perktype -> Ast.perktype -> Ast.perktype

Utility function to add a parameter (i.e., self) to a type, iff it is a functional

val add_parameter_to_func_only : Ast.perktype -> Ast.perktype -> Ast.perktype

Utility function to add a parameter (i.e., self) to a type, iff it is a function

val add_parameter_to_func_2 : Ast.perktype -> Ast.perktype -> Ast.perktype

Utility function to add a parameter (i.e., self) to a type, iff it is a function

val void_type : Ast.perktype
val int_type : Ast.perktype
val float_type : Ast.perktype
val char_type : Ast.perktype
val bool_type : Ast.perktype
val void_pointer : Ast.perktype
val self_type : Ast.perkident -> Ast.perktype
val func_of_lambda_void : Ast.perktype -> Ast.perktype

Transorms a lambda to a function

val functype_of_lambdatype : Ast.perktype -> Ast.perktype

Transforms a function type to a lambda type.

val lambdatype_of_func : Ast.perktype -> Ast.perktype

Transforms a lambda type to a function type.

val lambdatype_of_func_with_self : Ast.perktype -> Ast.perktype -> Ast.perktype

Transforms a function type with a self argument to a lambda type

val lambda_expr_of_func_expr_with_self : Ast.expr_a -> Ast.perktype -> Ast.perktype -> Ast.expr_a

Transforms a function expression with a self argument to a lambda expression

val lambda_expr_of_func_expr : Ast.expr_a -> Ast.perktype -> Ast.expr_a

Transforms a function expression to a lambda expression.

val lambda_def_of_func_def : Ast.perkdef -> Ast.perkdef

Transforms a function definition to a lambda definition

val lambda_def_of_func_def_ : Ast.perkdef -> Ast.perkdef
val discard_type_aq : Ast.perktype -> Ast.perktype_partial

Discards attributes and qualifiers of a type.

val lambda_of_func : Ast.perkfundef -> Ast.expr_t

Tranforms a function definition to a lambda definition

val decl_of_deforfun : Ast.deforfun_a -> Ast.perktype_attribute list * Ast.perkdecl

Transform a variable or function definition to a declaration.

val decl_of_declorfun : Ast.declorfun_a -> Ast.perkdecl

Transform a variable or function declaration to a declaration.

val funtype_of_perkfundef : Ast.perkfundef -> Ast.perktype

Given a function definition, returns its function type.

val get_member_functions : Ast.deforfun_a list -> Ast.perkident list

Given a list of annotated variable or function definitions, returns the identifiers of the defined functions

val add_attrs_to_deforfun : Ast.perktype_attribute list -> Ast.deforfun_a -> Ast.deforfun_a