package minicaml

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

A value identifier

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 show_list_pattern : list_pattern -> Ppx_deriving_runtime.string
type 'a env_t = (string * 'a) list

A purely functional environment type, parametrized

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 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 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
OCaml

Innovation. Community. Security.