Module Gobba.Types
module D = Util.Dict
val pp_ide : Ppx_deriving_runtime.Format.formatter -> ide -> Ppx_deriving_runtime.unit
val show_ide : ide -> Ppx_deriving_runtime.string
val equal_ide : ide -> ide -> Ppx_deriving_runtime.bool
val compare_ide : ide -> ide -> Ppx_deriving_runtime.int
type complext
= Stdlib.Complex.t
A type wrapper for complex numbers where equality, ordering and showing are defined
val pp_complext : Ppx_deriving_runtime.Format.formatter -> complext -> Ppx_deriving_runtime.unit
val show_complext : complext -> Ppx_deriving_runtime.string
val equal_complext : complext -> complext -> Ppx_deriving_runtime.bool
val compare_complext : complext -> complext -> Ppx_deriving_runtime.int
type purityenv_type
= (ide, puret) Util.Dict.t
An environment type containing identifier - purity couples
A type representing if a computation is pure or not
and puret
=
|
Impure
|
Uncertain
|
PurityModule of purityenv_type
|
Pure
|
Numerical
A type representing if a computation is pure or not
val pp_purityenv_type : Ppx_deriving_runtime.Format.formatter -> purityenv_type -> Ppx_deriving_runtime.unit
val show_purityenv_type : purityenv_type -> Ppx_deriving_runtime.string
val pp_puret : Ppx_deriving_runtime.Format.formatter -> puret -> Ppx_deriving_runtime.unit
val show_puret : puret -> Ppx_deriving_runtime.string
val equal_purityenv_type : purityenv_type -> purityenv_type -> Ppx_deriving_runtime.bool
val equal_puret : puret -> puret -> Ppx_deriving_runtime.bool
val compare_purityenv_type : purityenv_type -> purityenv_type -> Ppx_deriving_runtime.int
val compare_puret : puret -> puret -> Ppx_deriving_runtime.int
val pp_primitiveinfo : Ppx_deriving_runtime.Format.formatter -> primitiveinfo -> Ppx_deriving_runtime.unit
val show_primitiveinfo : primitiveinfo -> Ppx_deriving_runtime.string
val equal_primitiveinfo : primitiveinfo -> primitiveinfo -> Ppx_deriving_runtime.bool
val compare_primitiveinfo : primitiveinfo -> primitiveinfo -> Ppx_deriving_runtime.int
type binop
=
|
Getkey
|
Eq
|
Gt
|
Lt
|
Ge
|
Le
|
And
|
Or
|
Plus
|
Sub
|
Div
|
Mult
|
Cons
|
Concat
|
Compose
Represents a binary operation kind
val pp_binop : Ppx_deriving_runtime.Format.formatter -> binop -> Ppx_deriving_runtime.unit
val show_binop : binop -> Ppx_deriving_runtime.string
val equal_binop : binop -> binop -> Ppx_deriving_runtime.bool
val compare_binop : binop -> binop -> Ppx_deriving_runtime.int
type expr
=
|
Unit
|
Purity of puret * expr
|
NumInt of int
|
NumFloat of float
|
NumComplex of complext
|
Boolean of bool
|
String of string
|
Symbol of ide
|
List of expr list
|
Dict of assignment_type list
|
Binop of binop * expr * expr
|
Not of expr
|
IfThenElse of expr * expr * expr
|
Let of assignment_type list * expr
|
Lambda of ide * expr
|
Apply of expr * expr
|
ApplyPrimitive of primitiveinfo * expr list
|
Sequence of expr * expr
The type representing Abstract Syntax Tree expressions
val pp_expr : Ppx_deriving_runtime.Format.formatter -> expr -> Ppx_deriving_runtime.unit
val show_expr : expr -> Ppx_deriving_runtime.string
val pp_assignment_type : Ppx_deriving_runtime.Format.formatter -> assignment_type -> Ppx_deriving_runtime.unit
val show_assignment_type : assignment_type -> Ppx_deriving_runtime.string
val equal_expr : expr -> expr -> Ppx_deriving_runtime.bool
val equal_assignment_type : assignment_type -> assignment_type -> Ppx_deriving_runtime.bool
val compare_expr : expr -> expr -> Ppx_deriving_runtime.int
val compare_assignment_type : assignment_type -> assignment_type -> Ppx_deriving_runtime.int
val findbody : expr -> expr
Function that finds a nested lambda body
Function that finds and replaces a (nested) lambda body
val replacebody : expr -> expr -> expr
Function that finds and replaces a (nested) lambda body
Function that creates a list with the params of a nested lambda
val simple_show_expr : expr -> Ppx_deriving_runtime.string
Show a short representation of an expression (useful for stack traces)
val apply_from_exprlist : expr list -> expr -> expr
Creates a nested Apply from a list of expressions
type directive
=
|
Dumpenv
|
Dumppurityenv
|
Includefile of string
|
Includefileasmodule of string * ide option
|
Setpurity of puret
|
Setverbose of int
A type containing directives information
val pp_directive : Ppx_deriving_runtime.Format.formatter -> directive -> Ppx_deriving_runtime.unit
val show_directive : directive -> Ppx_deriving_runtime.string
val equal_directive : directive -> directive -> Ppx_deriving_runtime.bool
val compare_directive : directive -> directive -> Ppx_deriving_runtime.int
type command
=
|
Directive of directive
|
Expr of expr
|
Def of assignment_type list
A type useful for evaluating files, stating if a command is an expression or simply a "global" declaration (appended to environment)
val pp_command : Ppx_deriving_runtime.Format.formatter -> command -> Ppx_deriving_runtime.unit
val show_command : command -> Ppx_deriving_runtime.string
val equal_command : command -> command -> Ppx_deriving_runtime.bool
val compare_command : command -> command -> Ppx_deriving_runtime.int
type evt
=
|
EvtUnit
|
EvtInt of int
|
EvtFloat of float
|
EvtComplex of complext
|
EvtBool of bool
|
EvtString of string
|
EvtList of evt list
|
EvtDict of (ide * evt) list
Recursion is achieved by keeping an optional function name in the constructor
|
Closure of ide option * ide * expr * env_type
|
LazyExpression of expr
A type that represents an evaluated (result of a computation) value
and env_type
= (ide, evt) D.t
and typeinfo
=
|
TUnit
|
TBool
|
TNumber
|
TInt
|
TFloat
|
TComplex
|
TString
|
TList
|
TDict
|
TLambda
A type containing information about types
val pp_evt : Ppx_deriving_runtime.Format.formatter -> evt -> Ppx_deriving_runtime.unit
val show_evt : evt -> Ppx_deriving_runtime.string
val pp_env_type : Ppx_deriving_runtime.Format.formatter -> env_type -> Ppx_deriving_runtime.unit
val show_env_type : env_type -> Ppx_deriving_runtime.string
val pp_typeinfo : Ppx_deriving_runtime.Format.formatter -> typeinfo -> Ppx_deriving_runtime.unit
val show_typeinfo : typeinfo -> Ppx_deriving_runtime.string
val equal_evt : evt -> evt -> Ppx_deriving_runtime.bool
val equal_env_type : env_type -> env_type -> Ppx_deriving_runtime.bool
val equal_typeinfo : typeinfo -> typeinfo -> Ppx_deriving_runtime.bool
val compare_evt : evt -> evt -> Ppx_deriving_runtime.int
val compare_env_type : env_type -> env_type -> Ppx_deriving_runtime.int
val compare_typeinfo : typeinfo -> typeinfo -> Ppx_deriving_runtime.int
val show_tinfo : typeinfo -> string
val generate_prim_params : int -> string list
val show_unpacked_evt : evt -> Ppx_deriving_runtime.string
val findevtparams : evt -> ide list
Function that creates a list with the params of a nested lambda in a Closure
type primitive
=
|
Primitive of evt list -> evt * primitiveinfo
A type representing a primitive
val get_primitive_function : primitive -> evt list -> evt
Get the actual function from a primitive type
val get_primitive_info : primitive -> primitiveinfo
Get the information from a primitive type
type stackframe
=
|
StackValue of int * expr * stackframe
|
EmptyStack
A recursive type representing a stacktrace frame
val pp_stackframe : Ppx_deriving_runtime.Format.formatter -> stackframe -> Ppx_deriving_runtime.unit
val show_stackframe : stackframe -> Ppx_deriving_runtime.string
val push_stack : stackframe -> expr -> stackframe
Push an AST expression into a stack
- parameter s
The stack where to push the expression
- parameter e
The expression to push
val pop_stack : stackframe -> stackframe
Pop an AST expression from a stack
val depth_of_stack : stackframe -> int
val string_of_stack : int -> stackframe -> string
type evalstate
=
{
env : env_type;
purityenv : purityenv_type;
verbosity : int;
stack : stackframe;
mutable printresult : bool;
purity : puret;
}
Options for the eval function