WAM for everyone: a virtual machine for logic programming
David Scott Warren · ACM eBooks · 2018
This chapter is a tutorial presentation of the Warren Abstract Machine (akaWAM), which is a virtual machine for Prolog designed by David H. D.Warren [Warren 1983] (note not David S. Warren, who is the author of this chapter.) We present a variant of the WAM by developing it incrementally through a series of examples. Its similarity to a traditional implementation of a procedural language is emphasized. The development starts with a description of the run-time environment that supports Prolog program execution. Then it is shown how deterministic Datalog programs compile to WAM instructions, followed by deterministic Prolog programs that include complex terms, and finally nondeterministic Prolog programs that require backtracking.