A stack-based, concatenative programming language and execution environment implemented in Rust with WebAssembly browser support.
🌐 Live Interactive Web Playground
Stack Control is a modern concatenative language inspired by array and stack-oriented languages like Forth and Uiua. Programs operate directly on a global value stack where operations consume arguments from the top of the stack and push back results.
The project is structured as a modular Rust workspace:
stack-control: Core parser, lexer, AST, and stack VM runtime.stack-control-wasm: WebAssembly bridge exposing the interpreter directly to JavaScript/TypeScript.stack-control-site: Interactive web-based IDE and documentation browser written in React & TypeScript.stack-control-shell: Fast terminal REPL and execution shell.stack-control-doc: Automated documentation and reference generator.
- Concatenative Stack VM: Pure evaluation model supporting numbers, strings, arrays, and first-class functions.
- Higher-Order Combinators: Functions such as
each, mapping, reduction, and conditional branching (if/else). - WebAssembly Engine: Compiles to standalone WASM for zero-latency in-browser execution with real-time stack inspection.
- Interactive REPL: Unicode-aware terminal shell with instant feedback.
5 3 add // Pushes 5, pushes 3, computes 5 + 3 = 8
8 2 div // Result: 4
// Multiply each item in [1, 2, 3] by 2 -> [2, 4, 6]
[1 2 3] (2 mul) each
// Filter / conditional evaluation
[10 20 30] (15 gt) filter
- Rust toolchain (Cargo)
# Clone the repository
git clone https://github.com/CREAsTIVE/StackControl.git
cd StackControl
# Run the terminal shell
cargo run --package stack-control-shell# Build WASM package
cd stack-control-wasm
wasm-pack build --target web
# Run the web frontend
cd ../stack-control-site
npm install
npm run dev