1
0
Fork 0
cl-sites/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node179.html
2023-10-25 11:23:21 +02:00

51 lines
2.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>20. The Evaluator</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" The Evaluator">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html3761 HREF="node180.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html3759 HREF="clm.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html3753 HREF="node178.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html3763 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html3764 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html3762 HREF="node180.html"> Run-Time Evaluation of </A>
<B>Up:</B> <A NAME=tex2html3760 HREF="clm.html">Common Lisp the Language</A>
<B> Previous:</B> <A NAME=tex2html3754 HREF="node178.html"> Other Aspects of </A>
<HR> <P>
<H1><A NAME=SECTION002400000000000000000>20. The Evaluator</A></H1>
<P>
The mechanism that executes Lisp programs is called the evaluator.
More precisely, the evaluator accepts a form and performs the
computation specified by the form. This mechanism is made available
to the user through the function <tt>eval</tt>.
<P>
The evaluator is typically implemented as an interpreter
that traverses the given form recursively, performing each step
of the computation as it goes. An interpretive implementation is not
required, however. A permissible alternative approach is
for the evaluator first to completely compile the form into
machine-executable code and then invoke the resulting code.
This technique virtually eliminates incompatibilities
between interpreted and compiled code but also renders the <tt>evalhook</tt>
mechanism relatively useless.
Various mixed strategies are also possible. All of these approaches
should produce the same results when executing a correct program
but may produce different results for incorrect programs.
For example, the approaches may differ as to when macro calls
are expanded; macro definitions should not depend on the time
at which they are expanded. Implementors should
document the evaluation strategy for each implementation.
<P>
<HR>
<UL>
<LI> <A NAME=tex2html3765 HREF="node180.html#SECTION002410000000000000000"> Run-Time Evaluation of Forms</A>
<LI> <A NAME=tex2html3766 HREF="node181.html#SECTION002420000000000000000"> The Top-Level Loop</A>
</UL>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>