Prol: WAM demo
This is a simplified Warren Abstract Machine (WAM) implementation for Prolog, that showcases the main instructions, compiling, register allocation and machine functions.
Code organization
- model.py: Data objects representing terms, programs, and machine entities.
- compiler.py: Compiling of a list of rules into a list of instructions.
- interpreter.py: Interpreter that execute the instruction listing for a given query.
- grammar.py: Sample application of interpreter, with a grammar that can parse itself. Try it out with
python -m grammar
and compare with the text in the file!
Documentation
- About Prolog: a hurried primer if you don't know what it is about.
- Resolution strategy: how a query is actually solved in Prolog.
- Warren Abstract Machine: details about the implementation attempted here.
- Indexing: indexing implementation to fast-track some call patterns.
- Parsing: explaining basic structures for parsing
- Grammar: documentation for the sample application of grammar parsing.
- Stuff left out: what this implementation has simplified from the WAM, and references.