Questions tagged [warren-abstract-machine]

The Warren Abstract Machine (WAM) is an abstract machine for the execution of Prolog consisting of a memory architecture and an instruction set designed in 1983 by David H. D. Warren.

In 1983, David H. D. Warren designed an abstract machine for the execution of Prolog consisting of a memory architecture and an instruction set known as the Warren Abstract Machine (WAM).

Purpose

The purpose of compiling Prolog code to the more low-level WAM code is to make subsequent interpretation of the Prolog program more efficient. Prolog code is reasonably easy to translate to WAM instructions which can be more efficiently interpreted. Also, subsequent code improvements and compilation to native code are often easier to perform on the more low-level representation.

Memory areas

The WAM has the following memory areas:

  • The global stack or heap, used to store compound terms;
  • The local stack for environment frames and choice-points;
  • The trail to record which variables bindings ought to be undone on backtracking.

Relevance for Prolog users

In order to write efficient Prolog programs, a basic understanding of how the WAM works can be advantageous. Some of the most important WAM concepts are first argument indexing and its relation to choice-points, tail call optimization and memory reclamation on failure.

Source:http://en.wikipedia.org/wiki/Warren_Abstract_Machine

16 questions
0
votes
1 answer

Does WAM Prolog have a Symbol Table?

I am trying to program a WAM implementation of Prolog in C. I have noticed that the Prolog datatypes are described in only four token types: REF, STR, CON and LIS. Each cell in the execution heap contains the type of the token, and its position in…
Skalwalker
  • 299
  • 3
  • 23
1
2