This commit is contained in:
2026-01-21 17:05:30 +01:00
commit 67322381c3
59 changed files with 10421 additions and 0 deletions

28
src/model/script.rs Normal file
View File

@@ -0,0 +1,28 @@
use super::forth::Forth;
pub use super::forth::{ExecutionTrace, Rng, SourceSpan, StepContext, Variables};
pub struct ScriptEngine {
forth: Forth,
}
impl ScriptEngine {
pub fn new(vars: Variables, rng: Rng) -> Self {
Self {
forth: Forth::new(vars, rng),
}
}
pub fn evaluate(&self, script: &str, ctx: &StepContext) -> Result<Vec<String>, String> {
self.forth.evaluate(script, ctx)
}
pub fn evaluate_with_trace(
&self,
script: &str,
ctx: &StepContext,
trace: &mut ExecutionTrace,
) -> Result<Vec<String>, String> {
self.forth.evaluate_with_trace(script, ctx, trace)
}
}