From: Pekka Niiranen
Subject: Starting point needed: Eval done right?
Date: 
Message-ID: <4237eb40$0$4036$39db0f71@news.song.fi>
Hi there,

I am searching for information to the following questions
since I am planning to write Lisp interpreter myself:

1) I have not read sources of various Common Lisp implementations
yet (but before I start) does universally accepted
definition of Eval exist?

2) Where can I find collected list of "onions" of Common Lisp
and propositions of how to hack Eval to solve
them (even if hacks violate ANSI stardard)?

-pekka-

From: obfuscatedcode
Subject: Re: Starting point needed: Eval done right?
Date: 
Message-ID: <1110984093.168710.36030@f14g2000cwb.googlegroups.com>
Pekka Niiranen wrote:

<snip>

> 2) Where can I find collected list of "onions" of Common Lisp
> and propositions of how to hack Eval to solve
> them (even if hacks violate ANSI stardard)?

Here's a link to Paul Graham's "The Roots of Lisp". In it he develops
the basic Lisp primitives needed for an implementation of Lisp (not
Common Lisp). Also, he covers the implementation of EVAL. It's only 13
pages long, which is nice.

http://paulgraham.com/rootsoflisp.html
From: Pascal Bourguignon
Subject: Re: Starting point needed: Eval done right?
Date: 
Message-ID: <87fyyvrd43.fsf@thalassa.informatimago.com>
Pekka Niiranen <··············@wlanmail.com> writes:

> Hi there,
> 
> I am searching for information to the following questions
> since I am planning to write Lisp interpreter myself:
> 
> 1) I have not read sources of various Common Lisp implementations
> yet (but before I start) does universally accepted
> definition of Eval exist?

Each implementation can do it as it want, as long as it does what is
specified.

Of course, the eval of scheme will not be the same as the eval of
Common-Lisp, or the eval of some other random lisp.

Even for a given language, it can be as different as an interpreter is
different from a call to a compiler followed by the execution of the
compiled code...


> 2) Where can I find collected list of "onions" of Common Lisp
> and propositions of how to hack Eval to solve
> them (even if hacks violate ANSI stardard)?

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
I need a new toy.
Tail of black dog keeps good time.
Pounce! Good dog! Good dog!
From: Pascal Costanza
Subject: Re: Starting point needed: Eval done right?
Date: 
Message-ID: <39qndeF666dasU1@individual.net>
Pekka Niiranen wrote:
> Hi there,
> 
> I am searching for information to the following questions
> since I am planning to write Lisp interpreter myself:
> 
> 1) I have not read sources of various Common Lisp implementations
> yet (but before I start) does universally accepted
> definition of Eval exist?

Checking the sources of Common Lisp implementations probably doesn't 
help a lot, since they may evaluate expressions by first compiling them, 
or do something in between interpretation or compilation. If you want to 
understand eval, read something about metacircular interpreters. "The 
Art of the Interpreter" by Sussman and Steele is a good start. (Google 
for it.) Paul Graham's "The Roots of Lisp" is also quite good.

> 2) Where can I find collected list of "onions" of Common Lisp
> and propositions of how to hack Eval to solve
> them (even if hacks violate ANSI stardard)?

*macroexpand-hook* allows you to hook into the process of 
macroexpansion. However, there is no guarantee that this is also used 
for non-macro forms, IIRC, and this is only run at macroexpansion-time 
(of course). Other Lisp dialects, and I think also CLtL1, have/had 
*eval-hook* that allows you to do something along the same lines for 
evaluation.

Nowadays, a cheaper way to achieve something similar are 
before/after/around methods for generic functions in CLOS. LispWorks 
also provides an "advice facility" that allows you to define 
before/after/around stuff for non-generic functions. Depending on your 
concrete needs, this may be sufficient.


Pascal
From: Pascal Bourguignon
Subject: Re: Starting point needed: Eval done right?
Date: 
Message-ID: <87ekeeffcy.fsf@thalassa.informatimago.com>
Pekka Niiranen <··············@wlanmail.com> writes:
> I am searching for information to the following questions
> since I am planning to write Lisp interpreter myself:
> 
> 1) I have not read sources of various Common Lisp implementations
> yet (but before I start) does universally accepted
> definition of Eval exist?

If you want an example of a simple EVAL (for the first LISP defined in
AIM-8 by John McCarthy in March 1959), check at the end of the page:

http://www.informatimago.com/develop/lisp/small-cl-pgms/index.html

the aim-8.lisp and aim-8.aim-8 sources.


http://www.ai.mit.edu/research/publications/browse/0000browse.shtml
ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-008.pdf

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Grace personified,
I leap into the window.
I meant to do that.