| Crates.io | kz80_prolog |
| lib.rs | kz80_prolog |
| version | 0.1.0 |
| created_at | 2025-12-18 03:30:20.745318+00 |
| updated_at | 2025-12-18 03:30:20.745318+00 |
| description | Prolog compiler for Z80 - Logic programming on the RetroShield |
| homepage | https://github.com/ajokela/kz80_prolog |
| repository | https://github.com/ajokela/kz80_prolog |
| max_upload_size | |
| id | 1991635 |
| size | 308,243 |
A Prolog compiler for the Z80 processor, targeting the RetroShield platform.
is, +, -, *, /, mod)<, >, =<, >=, =:=, =\=)[H|T])!) for control flowwrite, nl)# Compile a Prolog program to Z80 binary
kz80_prolog program.pl -o program.bin
# Print AST (for debugging)
kz80_prolog --ast program.pl
# Print tokens (for debugging)
kz80_prolog --tokens program.pl
% family.pl
parent(tom, bob).
parent(bob, pat).
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).
?- ancestor(tom, pat).
The compiler uses a Simplified Prolog Machine (SPM) approach:
ROM (8KB):
0x0000-0x00FF Startup
0x0100-0x0EFF SPM interpreter
0x0F00-0x13FF Runtime library
0x1400-0x1BFF Compiled bytecode
0x1C00-0x1FFF Atom table
RAM (6KB):
0x2000-0x27FF Heap
0x2800-0x2FFF Trail
0x3000-0x35FF Stack
0x3600-0x37FF Registers
cargo build --release
cargo test
BSD-3-Clause