To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Warren Abstract Machine

From Wikipedia, the free encyclopedia

In 1983, David H. D. Warren designed an abstract machine for the execution of Prolog consisting of a memory architecture and an instruction set.[1][2][3] This design became known as the Warren Abstract Machine (WAM) and has become the de facto standard target for Prolog compilers.

YouTube Encyclopedic

  • 1/3
    Views:
    1 411
    142 872
    554
  • Abstract machine
  • Can We Build an Artificial Hippocampus?
  • Warren Lecture Series, May 8, Jerome P. Lynch, University of Michigan

Transcription

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 compilations to native code are often easier to perform on the more low-level representation.

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.

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

Example

Here is a piece of Prolog code:

 girl(sally).
 girl(jane).
 
 boy(B) :- \+ girl(B).

A WAM-based Prolog compiler will compile this into WAM instructions similar to the following:

 predicate(girl/1):
    switch_on_term(2,1,fail,fail,fail),
 label(1): switch_on_atom([(sally,3),(jane,5)])
 label(2): try_me_else(4)
 label(3): get_atom(sally,0)
           proceed
 label(4): trust_me_else_fail
 label(5): get_atom(jane,0)
           proceed
 
 predicate(boy/1):
    get_variable(x(1),0)
    put_structure(girl/1,0)
    unify_local_value(x(1))
    execute((\+)/1)])

An important characteristic of this code is its ability to cope with the various modes in which the predicates can be evoked: any argument might be a variable, a ground term, or a partly instantiated term. The "switch" instructions handle the different cases.

References

  1. ^ David H. D. Warren (October 1983). An abstract Prolog instruction set (PDF). Menlo Park, CA, USA: Artificial Intelligence Center at SRI International. Archived (PDF) from the original on 2022-06-19.
  2. ^ Hassan Aït-Kaci (February 18, 1999). Warren's Abstract Machine: A Tutorial Reconstruction (PDF). Archived from the original on 2003-02-13.{{cite book}}: CS1 maint: unfit URL (link)
  3. ^ Hassan Aït-Kaci. "Warren's Abstract Machine: A Tutorial Reconstruction; the book, errata and slides". Archived from the original on 19 January 2022. Retrieved 7 March 2011.
This page was last edited on 13 February 2024, at 03:49
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.