package minicaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type ide = string

A value identifier

val pp_ide : Ppx_deriving_runtime.Format.formatter -> ide -> Ppx_deriving_runtime.unit
type expr =
  1. | Unit
  2. | Integer of int
  3. | Boolean of bool
  4. | Symbol of ide
  5. | List of list_pattern
  6. | Head of expr
  7. | Tail of expr
  8. | Cons of expr * expr
  9. | Sum 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. | And of expr * expr
  16. | Or of expr * expr
  17. | Not of expr
  18. | IfThenElse of expr * expr * expr
  19. | Let of ide * expr * expr
  20. | Letlazy of ide * expr * expr
  21. | Letrec of ide * expr * expr
  22. | Letreclazy of ide * expr * expr
  23. | Lambda of ide list * expr
  24. | Apply of expr * expr list

The type representing Abstract Syntax Tree expressions

and list_pattern =
  1. | EmptyList
  2. | ListValue of expr * list_pattern

A type to build lists, mutually recursive with `expr`

val pp_expr : Ppx_deriving_runtime.Format.formatter -> expr -> Ppx_deriving_runtime.unit
val pp_list_pattern : Ppx_deriving_runtime.Format.formatter -> list_pattern -> Ppx_deriving_runtime.unit
val show_list_pattern : list_pattern -> Ppx_deriving_runtime.string
type 'a env_t = (string * 'a) list

A purely functional environment type, parametrized

val pp_env_t : 'a. (Ppx_deriving_runtime.Format.formatter -> 'a -> Ppx_deriving_runtime.unit) -> Ppx_deriving_runtime.Format.formatter -> 'a env_t -> Ppx_deriving_runtime.unit
val show_env_t : 'a. (Ppx_deriving_runtime.Format.formatter -> 'a -> Ppx_deriving_runtime.unit) -> 'a env_t -> Ppx_deriving_runtime.string
type evt =
  1. | EvtUnit
  2. | EvtInt of int
  3. | EvtBool of bool
  4. | EvtList of evt list
  5. | Closure of ide list * expr * type_wrapper env_t
    (*

    RecClosure keeps the function name in the constructor for recursion

    *)
  6. | RecClosure of ide * ide list * expr * type_wrapper env_t

A type that represents an evaluated (reduced) value

and type_wrapper =
  1. | LazyExpression of expr
  2. | AlreadyEvaluated of evt

Wrapper type that allows both AST expressions and evaluated expression for lazy evaluation

val pp_evt : Ppx_deriving_runtime.Format.formatter -> evt -> Ppx_deriving_runtime.unit
val pp_type_wrapper : Ppx_deriving_runtime.Format.formatter -> type_wrapper -> Ppx_deriving_runtime.unit
val show_type_wrapper : type_wrapper -> Ppx_deriving_runtime.string
val show_unpacked_evt : evt -> Ppx_deriving_runtime.string
type env_type = type_wrapper env_t

An environment of already evaluated values

type stackframe =
  1. | StackValue of int * expr * stackframe
  2. | 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 expand_list : expr list -> list_pattern

Convert a native list to an AST list

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

exception UnboundVariable of string
exception WrongBindList
exception TypeError of string
exception ListError of string
exception SyntaxError of string