package gobba

  1. Overview
  2. Docs
module T = ANSITerminal
module D = Util.Dict
type ide = string

A value identifier

val equal_ide : ide -> ide -> Ppx_deriving_runtime.bool
val compare_ide : ide -> ide -> Ppx_deriving_runtime.int
type complext = Complex.t

A type wrapper for complex numbers where equality, ordering and showing are defined

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 =
  1. | Impure
  2. | Uncertain
  3. | PurityModule of purityenv_type
  4. | Pure
  5. | Numerical

A type representing if a computation is pure or not

val show_purityenv_type : purityenv_type -> Ppx_deriving_runtime.string
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
type primitiveinfo = ide * int * puret

Contains a primitive's name, number of arguments and pureness

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 =
  1. | Getkey
  2. | Eq
  3. | Gt
  4. | Lt
  5. | Ge
  6. | Le
  7. | And
  8. | Or
  9. | Plus
  10. | Sub
  11. | Div
  12. | Mult
  13. | Cons
  14. | Concat
  15. | Compose

Represents a binary operation kind

val equal_binop : binop -> binop -> Ppx_deriving_runtime.bool
val compare_binop : binop -> binop -> Ppx_deriving_runtime.int
type expr =
  1. | Unit
  2. | Purity of puret * expr
  3. | NumInt of int
  4. | NumFloat of float
  5. | NumComplex of complext
  6. | Boolean of bool
  7. | String of string
  8. | Symbol of ide
  9. | List of expr list
  10. | Dict of assignment_type list
  11. | Binop of binop * expr * expr
  12. | Not of expr
  13. | IfThenElse of expr * expr * expr
  14. | Let of assignment_type list * expr
  15. | Lambda of ide * expr
  16. | Apply of expr * expr
  17. | ApplyPrimitive of primitiveinfo * expr list
  18. | Sequence of expr * expr

The type representing Abstract Syntax Tree expressions

and assignment_type = bool * ide * expr
val show_assignment_type : assignment_type -> Ppx_deriving_runtime.string
val equal_expr : expr -> expr -> 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 findparams : expr -> ide list

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 lambda_from_paramlist : ide list -> expr -> expr

Creates a nested Lambda from a list of params

val apply_from_exprlist : expr list -> expr -> expr

Creates a nested Apply from a list of expressions

val symbols_from_strings : ide list -> expr list

Creates a list of Symbol from a list of string

type directive =
  1. | Dumpenv
  2. | Dumppurityenv
  3. | Includefile of string
  4. | Includefileasmodule of string * ide option
  5. | Setpurity of puret
  6. | Setverbose of int

A type containing directives information

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 =
  1. | Directive of directive
  2. | Expr of expr
  3. | 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 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 =
  1. | EvtUnit
  2. | EvtInt of int
  3. | EvtFloat of float
  4. | EvtComplex of complext
  5. | EvtBool of bool
  6. | EvtString of string
  7. | EvtList of evt list
  8. | EvtDict of (ide * evt) list
    (*

    Recursion is achieved by keeping an optional function name in the constructor

    *)
  9. | Closure of ide option * ide * expr * env_type
  10. | LazyExpression of expr

A type that represents an evaluated (result of a computation) value

and env_type = (ide, evt) D.t
and typeinfo =
  1. | TUnit
  2. | TBool
  3. | TNumber
  4. | TInt
  5. | TFloat
  6. | TComplex
  7. | TString
  8. | TList
  9. | TDict
  10. | TLambda

A type containing information about types

val show_env_type : env_type -> Ppx_deriving_runtime.string
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 =
  1. | Primitive of evt list -> evt * primitiveinfo

A type representing a primitive

val get_primitive_purity : primitive -> puret

Get the purity of 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

val lambda_from_primitive : primitive -> expr

Generate a lambda from a primitive

type stackframe =
  1. | StackValue of int * expr * stackframe
  2. | EmptyStack

A recursive type representing a stacktrace frame

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 = {
  1. env : env_type;
  2. purityenv : purityenv_type;
  3. verbosity : int;
  4. stack : stackframe;
  5. mutable printresult : bool;
  6. purity : puret;
}

Options for the eval function