Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Interpreter_Runtime.H File Reference

Reusable runtime and structured evaluator for HIR-based interpreters. More...

#include <cctype>
#include <cerrno>
#include <cstdint>
#include <cstdlib>
#include <limits>
#include <memory>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <Compiler_HIR_Model.H>
#include <ah-diagnostics.H>
#include <ah-errors.H>
#include <tpl_dynArray.H>
Include dependency graph for Interpreter_Runtime.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::Interpreter_Runtime_Error
 Structured runtime error. More...
 
struct  Aleph::Interpreter_Value
 One runtime value. More...
 
struct  Aleph::Interpreter_Tuple_Storage
 Heap-owned tuple payload for recursive runtime values. More...
 
struct  Aleph::Interpreter_Binding
 One lexical binding inside an interpreter environment. More...
 
class  Aleph::Interpreter_Environment
 Nested runtime environment with lexical lookup semantics. More...
 
struct  Aleph::Interpreter_Runtime_Options
 Runtime options for the HIR evaluator. More...
 
struct  Aleph::Interpreter_Execution_Result
 Result of evaluating one expression, statement, module, or call. More...
 
class  Aleph::Interpreter_Runtime
 Structured runtime for executing typed HIR. More...
 
struct  Aleph::Interpreter_Runtime::Interpreter_Call_Frame
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 

Typedefs

using Aleph::Interpreter_Host_Function = bool(*)(void *user_data, const DynArray< Interpreter_Value > &arguments, Interpreter_Value &result, Interpreter_Runtime_Error &error)
 Host callback signature used by runtime built-ins or embeddings.
 

Enumerations

enum class  Aleph::Interpreter_Value_Kind {
  Aleph::Invalid , Aleph::Unit , Aleph::Bool , Aleph::Integer ,
  Aleph::String , Aleph::Character , Aleph::Tuple , Aleph::Function ,
  Aleph::Host_Function
}
 Runtime categories supported by the interpreter MVP. More...
 
enum class  Aleph::Interpreter_Control_Flow_Kind {
  Aleph::None , Aleph::Return , Aleph::Break , Aleph::Continue ,
  Aleph::Runtime_Error
}
 Structured control-flow outcomes during evaluation. More...
 

Functions

const char * Aleph::interpreter_value_kind_name (const Interpreter_Value_Kind kind) noexcept
 Stable debug name for one runtime value kind.
 
const char * Aleph::interpreter_control_flow_name (const Interpreter_Control_Flow_Kind kind) noexcept
 Stable debug name for one control-flow outcome.
 
bool Aleph::interpreter_values_equal (const Interpreter_Value &lhs, const Interpreter_Value &rhs)
 Returns whether two runtime values compare equal.
 
std::string Aleph::interpreter_value_to_string (const Interpreter_Value &value)
 Formats one runtime value deterministically for dumps and tests.
 
std::string Aleph::interpreter_dump_environment (const Interpreter_Environment &env)
 Dumps one environment deterministically.
 
std::string Aleph::interpreter_dump_globals (const Interpreter_Runtime &runtime)
 Dumps the globals currently installed in one runtime.
 

Detailed Description

Reusable runtime and structured evaluator for HIR-based interpreters.

This header adds the first execution-oriented layer on top of Compiler_HIR.H. The goal is not to hard-code one language runtime, but to provide a compact, reusable substrate that can execute small typed HIR programs and support interpreter-like tooling.

The current runtime includes:

  • runtime values for Unit, Bool, Int, String, Char, tuples, HIR functions, and host functions
  • nested environments with lexical lookup and assignment
  • a call stack for HIR function invocations
  • structured runtime errors with stable codes and source spans
  • evaluation of top-level statements and HIR functions

The MVP intentionally avoids heap management, user-defined closure syntax, and exceptions with stack unwinding. Those extensions are possible later without coupling the runtime to one concrete language front-end.

Definition in file Interpreter_Runtime.H.