package minicaml

  1. Overview
  2. Docs

Module Minicaml.TypesSource

Sourcetype ide = string

A value identifier

Sourceval compare_ide : ide -> ide -> Ppx_deriving_runtime.int
Sourcetype expr =
  1. | Unit
  2. | Integer of int
  3. | Boolean of bool
  4. | String of string
  5. | Symbol of ide
  6. | List of expr list
  7. | Cons of expr * expr
  8. | Dict of (expr * expr) list
  9. | Plus of expr * expr
  10. | Sub of expr * expr
  11. | Mult of expr * expr
  12. | Eq of expr * expr
  13. | Gt of expr * expr
  14. | Lt of expr * expr
  15. | Ge of expr * expr
  16. | Le of expr * expr
  17. | And of expr * expr
  18. | Or of expr * expr
  19. | Not of expr
  20. | IfThenElse of expr * expr * expr
  21. | Let of (ide * expr) list * expr
  22. | Letlazy of (ide * expr) list * expr
  23. | Letrec of ide * expr * expr
  24. | Letreclazy of ide * expr * expr
  25. | Lambda of ide list * expr
  26. | Apply of expr * expr list
  27. | Sequence of expr list
  28. | Pipe of expr * expr

The type representing Abstract Syntax Tree expressions

Sourceval compare_expr : expr -> expr -> Ppx_deriving_runtime.int
Sourcetype command =
  1. | Expr of expr
  2. | Def of (ide * expr) list
  3. | Defrec of (ide * expr) list

A type useful for evaluating files, stating if a command is an expression or simply a "global" declaration (appended to environment)

Sourceval compare_command : command -> command -> Ppx_deriving_runtime.int
Sourcetype 'a env_t = (string * 'a) list

A purely functional environment type, parametrized

Sourceval equal_env_t : 'a. ('a -> 'a -> Ppx_deriving_runtime.bool) -> 'a env_t -> 'a env_t -> Ppx_deriving_runtime.bool
Sourceval compare_env_t : 'a. ('a -> 'a -> Ppx_deriving_runtime.int) -> 'a env_t -> 'a env_t -> Ppx_deriving_runtime.int
Sourcetype evt =
  1. | EvtUnit
  2. | EvtInt of int
  3. | EvtBool of bool
  4. | EvtString of string
  5. | EvtList of evt list
  6. | EvtDict of (evt * evt) list
  7. | Closure of ide list * expr * type_wrapper env_t
    (*

    RecClosure keeps the function name in the constructor for recursion

    *)
  8. | RecClosure of ide * ide list * expr * type_wrapper env_t
    (*

    Abstraction that permits treating primitives as closures

    *)
  9. | PrimitiveAbstraction of ide * int * type_wrapper env_t

A type that represents an evaluated (reduced) value

Sourceand type_wrapper =
  1. | LazyExpression of expr
  2. | AlreadyEvaluated of evt
Sourceval compare_evt : evt -> evt -> Ppx_deriving_runtime.int
Sourceval generate_prim_params : int -> string list
Sourceval show_unpacked_evt : evt -> Ppx_deriving_runtime.string
Sourcetype env_type = type_wrapper env_t

An environment of already evaluated values

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

A recursive type representing a stacktrace frame

Sourceval 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

Sourceval pop_stack : stackframe -> stackframe

Pop an AST expression from a stack

Sourceexception UnboundVariable of string
Sourceexception TooManyArgs of string
Sourceexception WrongBindList
Sourceexception WrongPrimitiveArgs
Sourceexception TypeError of string
Sourceexception ListError of string
Sourceexception DictError of string
Sourceexception SyntaxError of string