<s>
In	O
1983	O
,	O
David	O
H	O
.	O
D	O
.	O
Warren	O
designed	O
an	O
abstract	B-Application
machine	I-Application
for	O
the	O
execution	O
of	O
Prolog	B-Language
consisting	O
of	O
a	O
memory	B-General_Concept
architecture	O
and	O
an	O
instruction	B-General_Concept
set	I-General_Concept
.	O
</s>
<s>
This	O
design	O
became	O
known	O
as	O
the	O
Warren	B-Application
Abstract	I-Application
Machine	I-Application
(	O
WAM	O
)	O
and	O
has	O
become	O
the	O
de	O
facto	O
standard	O
target	O
for	O
Prolog	B-Language
compilers	B-Language
.	O
</s>
<s>
The	O
purpose	O
of	O
compiling	B-Language
Prolog	B-Language
code	O
to	O
the	O
more	O
low-level	O
WAM	O
code	O
is	O
to	O
make	O
subsequent	O
interpretation	O
of	O
the	O
Prolog	B-Language
program	O
more	O
efficient	O
.	O
</s>
<s>
Prolog	B-Language
code	O
is	O
reasonably	O
easy	O
to	O
translate	O
to	O
WAM	O
instructions	O
,	O
which	O
can	O
be	O
more	O
efficiently	O
interpreted	O
.	O
</s>
<s>
Also	O
,	O
subsequent	O
code	O
improvements	O
and	O
compilations	B-Language
to	O
native	O
code	O
are	O
often	O
easier	O
to	O
perform	O
on	O
the	O
more	O
low-level	O
representation	O
.	O
</s>
<s>
In	O
order	O
to	O
write	O
efficient	O
Prolog	B-Language
programs	O
,	O
a	O
basic	O
understanding	O
of	O
how	O
the	O
WAM	O
works	O
can	O
be	O
advantageous	O
.	O
</s>
<s>
Some	O
of	O
the	O
most	O
important	O
WAM	O
concepts	O
are	O
first	O
argument	O
indexing	O
and	O
its	O
relation	O
to	O
choice-points	O
,	O
tail	B-Language
call	I-Language
optimization	I-Language
,	O
and	O
memory	B-General_Concept
reclamation	O
on	O
failure	O
.	O
</s>
<s>
The	O
WAM	O
has	O
the	O
following	O
memory	B-General_Concept
areas	O
:	O
</s>
<s>
Here	O
is	O
a	O
piece	O
of	O
Prolog	B-Language
code	O
:	O
</s>
<s>
A	O
WAM-based	O
Prolog	B-Language
compiler	B-Language
will	O
compile	B-Language
this	O
into	O
WAM	O
instructions	O
similar	O
to	O
the	O
following	O
:	O
</s>
