Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Warren Abstract Machine
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Example== Here is a piece of Prolog code: <syntaxhighlight lang="prolog"> girl(sally). girl(jane). boy(B) :- \+ girl(B). </syntaxhighlight> A WAM-based Prolog compiler will compile this into WAM instructions similar to the following: <syntaxhighlight lang="prolog"> 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)]) </syntaxhighlight> 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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)