Forth interpreter with compilation mode, 64 built-in primitives, and HTTP/KV outbound support.
i64cells, 65,536-cell memory, 1,024-depth stack limit- Compilation mode (
: word ... ;) compiles to token sequences, interpreted mode for immediate execution - 64 built-in primitives: stack ops, arithmetic, comparison, logic, I/O, control flow, loops, memory, variables/constants, strings, HTTP, KV
- Loop constructs:
do...loop,+loop,begin...until,begin...while...repeat,begin...again - HTTP outbound via coroutine/yield:
s" url" http-get,s" url" s" body" http-post,s" KEY" env - KV storage via coroutine/yield:
s" key" kv-get,s" key" s" value" kv-set,s" key" kv-del - Default instruction limit: 10,000,000 (configurable via
with_instruction_limit())
cargo install --path .
# Inline code
forth "3 4 + ."
# From file
forth -f program.fth
# Piped input
echo "hello" | forth "begin key dup while emit repeat"use otherfunc_forth::ForthInterpreter;
use otherfunc_core::Interpreter;
let mut forth = ForthInterpreter::new();
let output = forth.execute("3 4 + .", "").unwrap();
assert_eq!(output, "7 ");cargo test -p otherfunc-forth # 23 tests