1#![allow(clippy::result_large_err)]
2
3pub mod accel;
4pub mod bytecode;
5pub mod call;
6pub mod compiler;
7pub mod functions {
8 pub use crate::bytecode::program::{Bytecode, CallFrame, ExecutionContext, UserFunction};
9}
10pub mod indexing;
11pub mod instr {
12 pub use crate::bytecode::instr::{ArgSpec, EmitLabel, EndExpr, Instr, StackEffect};
13}
14pub mod interpreter;
15pub mod object;
16pub mod ops;
17pub mod runtime;
18
19pub use bytecode::compile;
20pub use bytecode::{
21 ArgSpec, Bytecode, CallFrame, EmitLabel, EndExpr, ExecutionContext, Instr, StackEffect,
22 UserFunction,
23};
24pub use compiler::CompileError;
25pub use interpreter::api::{
26 set_call_stack_limit, set_error_namespace, DEFAULT_CALLSTACK_LIMIT, DEFAULT_ERROR_NAMESPACE,
27};
28pub use interpreter::runner::{
29 interpret, interpret_function, interpret_function_with_counts, interpret_with_vars,
30};
31pub use interpreter::state::{InterpreterOutcome, InterpreterState};
32pub use runtime::workspace::{
33 push_pending_workspace, take_updated_workspace_state, PendingWorkspaceGuard,
34};
35
36use runmat_builtins::Value;
37use runmat_hir::HirProgram;
38use runmat_runtime::RuntimeError;
39use std::collections::HashMap;
40
41pub async fn execute(program: &HirProgram) -> Result<Vec<Value>, RuntimeError> {
42 let bc = compile(program, &HashMap::new()).map_err(RuntimeError::from)?;
43 interpret(&bc).await
44}