package minicaml

  1. Overview
  2. Docs

Module Minicaml.TypesSource

Sourcetype ide = string

An identifier

Sourcetype 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. | Letrec of ide * expr * expr
  21. | Lambda of ide list * expr
  22. | Apply of expr * expr list
Sourceand list_pattern =
  1. | EmptyList
  2. | ListValue of expr * list_pattern
Sourceval expand_list : expr list -> list_pattern
Sourceval show_expr : expr -> string
Sourceval show_list : list_pattern -> string
Sourcetype 'a env_t = (string * 'a) list

A purely functional environment type, parametrized

Sourcetype evt =
  1. | EvtUnit
  2. | EvtInt of int
  3. | EvtBool of bool
  4. | EvtList of evt list
  5. | Closure of ide list * expr * evt env_t
    (*

    RecClosure keeps the function name in the environment for recursion

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

A type that represents an evaluated (reduced) value

Sourceval show_evt : evt -> string

Function to get a string representation of an evaluated type

Sourcetype env_type = evt env_t

An environment type with

Sourceexception UnboundVariable of string

Exception to specify an unbound value

Sourceexception WrongBindList

Exception that indicates an erroneous usage of bindlist

Sourceexception TypeError of string

Typing exception

Sourceexception ListError of string

List exceptions *

Sourceexception SyntaxError of string

Exception to represent a syntax error

OCaml

Innovation. Community. Security.