| Crates.io | stack-assembly |
| lib.rs | stack-assembly |
| version | 0.1.0 |
| created_at | 2025-12-15 19:35:51.945969+00 |
| updated_at | 2025-12-15 19:35:51.945969+00 |
| description | minimalist, stack-based, assembly-like programming language |
| homepage | |
| repository | https://github.com/hannobraun/stack-assembly |
| max_upload_size | |
| id | 1986607 |
| size | 69,019 |
StackAssembly is a minimalist, stack-based, assembly-like programming language. Here's a small taste:
# Push `0` to the stack.
0
increment:
# Increment the value on the stack by `1`.
1 +
# If the value on the stack is smaller than `255`, jump to `increment:`.
0 copy 255 <
@increment
jump_if
# Looks like we didn't jump to `increment:` that last time, so the value must be
# `255` now.
255 = assert
StackAssembly serves as a foundation for my personal research into programming language design and implementation. Even though I want it to be complete enough for real code too, that is not its main purpose. If you're wondering if it might work for you, the safe answer is probably "no".
The initial implementation is complete, but testing (both automated and in terms of real-world use) has been limited. Feel free to try the language, but don't expect too much in terms of reliability or usefulness.
Check out the examples/ directory to see some StackAssembly code. To run a script, follow these steps:
cargo run -- path/to/script.stackFor example, to run the "control flow" example from the root directory of this repository, execute this command: cargo run -- examples/control-flow.stack
The StackAssembly interpreter is packaged as a library. That library's documentation covers mainly the interpreter API, but also provides information on the language. Right now, you must build the documentation locally to access it. With a working Rust setup, you can do so by running cargo doc --open.
The initial design document can serve as a (not fully complete) introduction to the language. The test suite covers the full language in all its detail, basically serving the role of a specification, but is not as friendly to approach.
This project is open source, licensed under the terms of the Zero-Clause BSD License (0BSD, for short). This basically means you can do anything with the code, without restrictions, but you can't hold the authors liable for any problems.
See LICENSE.md for details.