| Crates.io | kz80_smalltalk |
| lib.rs | kz80_smalltalk |
| version | 0.1.0 |
| created_at | 2025-12-12 21:06:22.53988+00 |
| updated_at | 2025-12-12 21:06:22.53988+00 |
| description | Tiny Smalltalk to Z80 compiler for RetroShield hardware |
| homepage | https://github.com/ajokela/kz80_smalltalk |
| repository | https://github.com/ajokela/kz80_smalltalk |
| max_upload_size | |
| id | 1982123 |
| size | 100,446 |
A Tiny Smalltalk compiler for the Z80 processor, targeting the RetroShield hardware platform.
+, -, *<, >, =cargo install kz80_smalltalk
Or build from source:
git clone https://github.com/ajokela/kz80_smalltalk
cd kz80_smalltalk
cargo build --release
# Compile a Smalltalk file to Z80 binary
kz80_smalltalk input.st -o output.bin
# Example
echo "42 + 7" > test.st
kz80_smalltalk test.st -o test.bin
The compiler supports a minimal subset of Smalltalk:
"Integer literals"
42
12345
"Arithmetic"
3 + 4
10 - 3
6 * 7
"Comparisons (return 1 for true, 0 for false)"
3 < 5
5 > 3
42 = 42
"Strings"
'Hello World'
"Chained operations (left to right evaluation)"
1 + 2 + 3
The compiler works in several stages:
lexer.rs) - Tokenizes Smalltalk source codeparser.rs) - Builds an AST from tokenscompiler.rs) - Generates bytecode from ASTcodegen.rs) - Emits Z80 machine code with bytecode interpreterAll integer arithmetic uses packed BCD format with the Z80's DAA (Decimal Adjust Accumulator) instruction for correct decimal results. This matches the approach used in other kz80 language implementations.
# Run all tests (10 unit + 38 integration)
cargo test
BSD-3-Clause
Part of the kz80 family of retro language compilers for Z80-based RetroShield hardware.