Expand description
kz80_prolog: Prolog compiler for Z80.
A Prolog implementation targeting the Z80 processor using a Simplified Prolog Machine (SPM) approach with compact bytecode and a small runtime interpreter.
§Features
- Facts and rules (Horn clauses)
- Unification of first-order terms
- Backtracking via choice points
- Atoms, variables, 16-bit integers
- Compound terms and lists
- Arithmetic evaluation and comparisons
- Cut for control flow
§Example
parent(tom, bob).
parent(bob, pat).
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).
?- ancestor(tom, pat).Re-exports§
pub use ast::ArithExpr;pub use ast::ArithOp;pub use ast::Clause;pub use ast::CompareOp;pub use ast::Goal;pub use ast::Program;pub use ast::Term;pub use lexer::Lexer;pub use lexer::LexerError;pub use parser::parse;pub use parser::ParseError;pub use parser::Parser;pub use token::Span;pub use token::Token;
Modules§
- analyze
- Variable analysis for Prolog clauses.
- ast
- Abstract Syntax Tree definitions for Prolog.
- codegen
- Code generator for Z80 ROM image output.
- compile
- Bytecode compiler for Prolog clauses.
- lexer
- Lexer for Prolog source code.
- parser
- Parser for Prolog source code.
- repl
- On-target REPL generator for Prolog on Z80
- runtime
- Z80 runtime for the Simplified Prolog Machine (SPM).
- symbol
- Symbol table for atom interning and predicate registry.
- token
- Token definitions for the Prolog lexer.