Feat: WIP terse code documentation

This commit is contained in:
2026-02-26 01:08:16 +01:00
parent 71bd09d5ea
commit e1cf57918e
47 changed files with 499 additions and 24 deletions

View File

@@ -14,6 +14,7 @@ use super::types::{
Value, Variables, VariablesMap,
};
/// Forth VM instance. Holds the stack, variables, dictionary, and RNG.
pub struct Forth {
stack: Stack,
vars: Variables,
@@ -45,12 +46,14 @@ impl Forth {
self.global_params.lock().clear();
}
/// Evaluate a Forth script and return audio command strings.
pub fn evaluate(&self, script: &str, ctx: &StepContext) -> Result<Vec<String>, String> {
let (outputs, var_writes) = self.evaluate_impl(script, ctx, None)?;
self.apply_var_writes(var_writes);
Ok(outputs)
}
/// Evaluate and collect an execution trace for UI highlighting.
pub fn evaluate_with_trace(
&self,
script: &str,
@@ -62,6 +65,7 @@ impl Forth {
Ok(outputs)
}
/// Evaluate and return both outputs and pending variable writes (without applying them).
pub fn evaluate_raw(
&self,
script: &str,