use cagire_forth::{Dictionary, ExecutionTrace, Forth, Rng, StepContext, Value, Variables};

pub struct ScriptEngine {
    forth: Forth,
}

impl ScriptEngine {
    pub fn new(vars: Variables, dict: Dictionary, rng: Rng) -> Self {
        Self {
            forth: Forth::new(vars, dict, 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)
    }

    pub fn clear_global_params(&self) {
        self.forth.clear_global_params();
    }

    pub fn stack(&self) -> Vec<Value> {
        self.forth.stack()
    }
}
