Module Tenyaeva_lib.Interpreter

Copyright 2025, Tenyaeva Ekaterina

SPDX-License-Identifier: LGPL-3.0-or-later

type eval_error =
  1. | TypeError
    (*

    Represents a type error that occurs when a type mismatch is detected in an expression.

    *)
  2. | DivisionByZero
    (*

    Represents the error that occurs when attempting to perform a division by zero operation.

    *)
  3. | MatchFailure
    (*

    Represents a match error occurs when a pattern matching attempt fails.

    *)
  4. | NoVariable of Ast.ident
    (*

    Represents an error that occurs when attempting to use a variable that has not been declared or initialized.

    *)
  5. | OutOfSteps
    (*

    Represents an error that occurs when the permissible number of interpretation steps is exceeded.

    *)
type value =
  1. | ValInt of int
  2. | ValBool of bool
  3. | ValUnit
  4. | ValFun of Ast.rec_flag * Ast.pattern * Ast.expression * environment
  5. | ValFunction of Ast.case list * environment
  6. | ValOption of value option
  7. | ValBuiltin of Ast.ident
and environment = (Ast.ident, value, Base.String.comparator_witness) Base.Map.t
val pp_value : Stdlib.Format.formatter -> value -> unit
val pp_eval_error : Stdlib.Format.formatter -> eval_error -> unit
val run_interpreter : Ast.structure -> int -> ((Ast.ident option * value) list, eval_error) Stdlib.Result.t