Hello group,
I am looking for some information about LISP interpreter internals,
how it works and how one could write his own LISP interpreter, even if
a simple one. I found some brief info about read-evaluate-print loop
and the internal structure of lists, but nothing comprehensive that
would help me to understand fully how LISP works. Any help is
appreciated.
Thank to all of you for the suggested sources of information.
From: Nils M Holm
Subject: Re: LISP interpreter internals
Date:
Message-ID: <f04gec$gg1$1@online.de>
Daniel Kalny <······@seznam.cz> wrote:
> I am looking for some information about LISP interpreter internals,
> how it works and how one could write his own LISP interpreter, even if
> a simple one. I found some brief info about read-evaluate-print loop
> and the internal structure of lists, but nothing comprehensive that
> would help me to understand fully how LISP works. Any help is
> appreciated.
If it does not have to be Common Lisp, you may have a look at
Scheme 9 from Empty Space, which is a pretty complete Scheme
implementation in less than 100K bytes of clean and comprehensible
code: http://t3x.org/bits/s9fes/
--
Nils M Holm <n m h @ t 3 x . o r g> -- http://t3x.org/nmh/
>>>>> "Daniel" == Daniel Kalny <······@seznam.cz> writes:
Daniel> Hello group, I am looking for some information about LISP
Daniel> interpreter internals, how it works and how one could
Daniel> write his own LISP interpreter, even if a simple one. I
Daniel> found some brief info about read-evaluate-print loop and
Daniel> the internal structure of lists, but nothing comprehensive
Daniel> that would help me to understand fully how LISP works. Any
Daniel> help is appreciated.
You will find lots of pointers to useful information at:
http://c2.com/cgi/wiki?ImplementingLisp
Andru
--
Andru Luvisi
Quote Of The Moment:
An argument based on analogy is like a house built on sand.
Daniel Kalny wrote:
> Hello group,
> I am looking for some information about LISP interpreter internals,
> how it works and how one could write his own LISP interpreter, even if
> a simple one. I found some brief info about read-evaluate-print loop
> and the internal structure of lists, but nothing comprehensive that
> would help me to understand fully how LISP works. Any help is
> appreciated.
Two good starting points are "The Roots of Lisp" by Paul Graham and "The
Art of the Interpreter" by Sussman and Steele.
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
Pascal Costanza <··@p-cos.net> wrote:
+---------------
| Daniel Kalny wrote:
| > Hello group,
| > I am looking for some information about LISP interpreter internals,
| > how it works and how one could write his own LISP interpreter, even if
| > a simple one. I found some brief info about read-evaluate-print loop
| > and the internal structure of lists, but nothing comprehensive that
| > would help me to understand fully how LISP works. Any help is
| > appreciated.
|
| Two good starting points are "The Roots of Lisp" by Paul Graham
| and "The Art of the Interpreter" by Sussman and Steele.
+---------------
And then when you're ready to *really* get your hands dirty,
Christian Queinnec's marvelous "LiSP", which covers numerous
design alternatives in the implementation of Lisp-like languages:
"Lisp in Small Pieces" [originally "Les langages Lisp"]
http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html
http://www-spi.lip6.fr/~queinnec/common/LiSPeng.png
I personally found "Chapter 6: Fast interpretation" to be
particularly useful as an introduction to the preprocessing
needed for fast lexical variables, including various alternatives
for the runtime representations of lexical environments [including
one particularly-tricky "gotcha" in the interaction between the
representation of closures and Scheme-style continuations].
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
On Wed, 18 Apr 2007 03:40:11 -0500, Rob Warnock wrote:
> Pascal Costanza <··@p-cos.net> wrote: +---------------
> | Daniel Kalny wrote:
> | > Hello group,
> | > I am looking for some information about LISP interpreter internals,
> | > how it works and how one could write his own LISP interpreter, even
> if | > a simple one. I found some brief info about read-evaluate-print
> loop | > and the internal structure of lists, but nothing comprehensive
> that | > would help me to understand fully how LISP works. Any help is |
> > appreciated.
> |
> | Two good starting points are "The Roots of Lisp" by Paul Graham | and
> "The Art of the Interpreter" by Sussman and Steele. +---------------
>
> And then when you're ready to *really* get your hands dirty, Christian
> Queinnec's marvelous "LiSP", which covers numerous design alternatives
> in the implementation of Lisp-like languages:
>
> "Lisp in Small Pieces" [originally "Les langages Lisp"]
> http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html
> http://www-spi.lip6.fr/~queinnec/common/LiSPeng.png
>
> I personally found "Chapter 6: Fast interpretation" to be particularly
> useful as an introduction to the preprocessing needed for fast lexical
> variables, including various alternatives for the runtime
> representations of lexical environments [including one
> particularly-tricky "gotcha" in the interaction between the
> representation of closures and Scheme-style continuations].
I haven't read Queinnec's LISP yet. Thanks for the ref.
Today I came across, and read "CONS Should Not CONS Its Arguments, Part
II: Cheney on the M.T.A." by Henry G Baker. http://home.pipeline.com/
~hbaker1/CheneyMTA.html
for me, that was a real eye-opener. Apparently Chicken Scheme works that
way. Do any of the Common Lisps do anything similar? (Not that they use
C compilers as code generators, but the strategy could probably still
apply.) Amazing idea, IMO.
Cheers,
--
Andrew
Andrew Reilly <···············@areilly.bpc-users.org> wrote:
+---------------
| Today I came across, and read "CONS Should Not CONS Its Arguments, Part
| II: Cheney on the M.T.A." by Henry G Baker. http://home.pipeline.com/
| ~hbaker1/CheneyMTA.html
|
| for me, that was a real eye-opener. Apparently Chicken Scheme works
| that way.
+---------------
Yes, but at some cost: (1) The *entire* core interpreter (VM)
[or at least any routines that ever allocate from the heap] had
to be written in CPS, which is a royal pain (at least during
bootstrapping); (2) The performance of code compiled by Chicken
Scheme [and, yes, it's mainly a batch compiler from Scheme to C,
not primarily a interpreter per se, though it does include a full
interactive interpreter & REPL as well] is not generally as fast
[the last time I heard] as some of the other "direct-style" compilers
such as Bigloo or Stalin/Larceny.
On the other hand, advantages include (1) being able to use a
precise GC (not "conservative"), and (2) very good portablility
across platforms. <http://www.call-with-current-continuation.org/>
says it runs on "x86, x86-64, IA-64, PowerPC, SPARC and UltraSPARC,
Alpha, MIPS, PA-RISC, ARM and S/390", at least.
+---------------
| Do any of the Common Lisps do anything similar?
+---------------
Not that I know of, but it's certainly an interesting idea!
Though note that one of the principle motivations for Chicken
using the "CONS Should Not CONS" approach was that it greatly
simplifies the implementation of "full" Scheme-style continuations.
If that's not a strong motivator for you [and it's usually less
important for most CL implementors, since there are many forms
in CL that interfere with fully-general tail-call optimization],
then a direct-style interpreter that uses "GC_Protect" macros in
the C code [like a recent thread here noted that OCaml/Elk/etc. do]
might work just as well.
+---------------
| (Not that they use C compilers as code generators...)
+---------------
Well, several CL's [ECL, GCL] *do* do already *THAT*... ;-} ;-}
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
On Apr 18, 2:25 am, Andrew Reilly <···············@areilly.bpc-
users.org> wrote:
>
> Today I came across, and read "CONS Should Not CONS Its Arguments, Part
> II: Cheney on the M.T.A." by Henry G Baker.http://home.pipeline.com/
> ~hbaker1/CheneyMTA.html
>
> for me, that was a real eye-opener. Apparently Chicken Scheme works that
> way. Do any of the Common Lisps do anything similar?
It isn't Common Lisp, but the first version of the Rebol interpreter
used this
technique. As Rob noted, it is royal pain to code the VM in CPS, but
it
is quite portable and you get first-class continuations for free.
In article <································@speakeasy.net>,
····@rpw3.org (Rob Warnock) wrote:
> Pascal Costanza <··@p-cos.net> wrote:
> +---------------
> | Daniel Kalny wrote:
> | > Hello group,
> | > I am looking for some information about LISP interpreter internals,
> | > how it works and how one could write his own LISP interpreter, even if
> | > a simple one. I found some brief info about read-evaluate-print loop
> | > and the internal structure of lists, but nothing comprehensive that
> | > would help me to understand fully how LISP works. Any help is
> | > appreciated.
> |
> | Two good starting points are "The Roots of Lisp" by Paul Graham
> | and "The Art of the Interpreter" by Sussman and Steele.
> +---------------
>
> And then when you're ready to *really* get your hands dirty,
> Christian Queinnec's marvelous "LiSP", which covers numerous
> design alternatives in the implementation of Lisp-like languages:
>
> "Lisp in Small Pieces" [originally "Les langages Lisp"]
> http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html
> http://www-spi.lip6.fr/~queinnec/common/LiSPeng.png
>
> I personally found "Chapter 6: Fast interpretation" to be
> particularly useful as an introduction to the preprocessing
> needed for fast lexical variables, including various alternatives
> for the runtime representations of lexical environments [including
> one particularly-tricky "gotcha" in the interaction between the
> representation of closures and Scheme-style continuations].
>
>
> -Rob
>
> -----
> Rob Warnock <····@rpw3.org>
> 627 26th Avenue <URL:http://rpw3.org/>
> San Mateo, CA 94403 (650)572-2607
Lisp in Small Pieces is a very good book.
Peter Norvig's book Paradigms of AI Programming
has also some content on language (Scheme) implementation.
Norvig, Peter. Paradigms of Artificial Intelligence
Programming: Case Studies in Common Lisp Morgan
Kaufmann, 1992. 946 pages. ISBN 1-55860-191-0
An advantage is also that his Common Lisp
programming style is highly readable.
In earlier times the classic book on Lisp implementation
was ' Allen, John. Anatomy of Lisp. McGraw-Hill, 1978.
446 pages. ISBN 0-07-001115-X'.
There are some articles here and there about Common Lisp
implementation issues. For example the book
Peter Lee, Editor.
Topics in Advanced Language Implementation.
The MIT Press, Cambridge, Mass., 1991.
has a chapter on CMUCL.
http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=8078
Much more about Scheme implementation here:
http://library.readscheme.org/page1.html
http://library.readscheme.org/page8.html
--
http://lispm.dyndns.org
Rainer Joswig <······@lisp.de> wrote:
> Lisp in Small Pieces is a very good book.
FWIW, there's a new version, only in French, that Christian
published on his own (a personal small publishing company) and that's
sold exclusively in a small Computer Science Library in Paris (Le Monde
en Tique). Nobody was interested in publishing a revised version of the
book, starting with the previous publisher who destroyed his stock of
the old version...
A pity if you ask me :-(
--
Read the Jazz Blog !! http://jazzblog.didierverna.com
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bic�tre, France Fax.+33 (1) 53 14 59 22 ······@xemacs.org
In article <···············@uzeb.lrde.epita.fr>,
Didier Verna <······@lrde.epita.fr> wrote:
> Rainer Joswig <······@lisp.de> wrote:
>
> > Lisp in Small Pieces is a very good book.
>
> FWIW, there's a new version, only in French, that Christian
> published on his own (a personal small publishing company) and that's
> sold exclusively in a small Computer Science Library in Paris (Le Monde
> en Tique). Nobody was interested in publishing a revised version of the
> book, starting with the previous publisher who destroyed his stock of
> the old version...
destroyed?!!!?? that's wild. crazy. unbelievable.
But that was the french original edition?
>
> A pity if you ask me :-(
http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html
Here is the publishing company and the
book 'Principes d'implantation de Scheme et Lisp':
http://paracamplus.com/?CGIRunMode=products
34 Euros is not that expensive given the excellent
contents of his book(s). Though it is french. ;-)
--
http://lispm.dyndns.org
Rainer Joswig <······@lisp.de> wrote:
> destroyed?!!!?? that's wild. crazy. unbelievable.
Yes. They said that given their sells (almost nothing these
days) it was more expensive for them to keep the stock.
> But that was the french original edition?
Not sure about that.
> 34 Euros is not that expensive given the excellent contents of his
> book(s). Though it is french. ;-)
Definitely. But the French doesn't bother me :-)
--
Read the Jazz Blog !! http://jazzblog.didierverna.com
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bic�tre, France Fax.+33 (1) 53 14 59 22 ······@xemacs.org
In article <···············@uzeb.lrde.epita.fr>,
Didier Verna <······@lrde.epita.fr> wrote:
> Rainer Joswig <······@lisp.de> wrote:
>
> > destroyed?!!!?? that's wild. crazy. unbelievable.
>
> Yes. They said that given their sells (almost nothing these
> days) it was more expensive for them to keep the stock.
>
>
> > But that was the french original edition?
>
> Not sure about that.
>
>
> > 34 Euros is not that expensive given the excellent contents of his
> > book(s). Though it is french. ;-)
>
> Definitely. But the French doesn't bother me :-)
I learned French for several years in school.
The teacher was excellent. Unfortunately I can't remember much.
(Re)Activating my French is still on my to do list.
Maybe I can (re) learn some French with a Lisp book... Hmm...
--
http://lispm.dyndns.org
On Wed, 18 Apr 2007 11:41:58 +0200, Rainer Joswig wrote:
> In article <···············@uzeb.lrde.epita.fr>,
> Didier Verna <······@lrde.epita.fr> wrote:
>
>> Rainer Joswig <······@lisp.de> wrote:
>>
>> > Lisp in Small Pieces is a very good book.
>>
>> FWIW, there's a new version, only in French, that Christian
>> published on his own (a personal small publishing company) and that's
>> sold exclusively in a small Computer Science Library in Paris (Le Monde
>> en Tique). Nobody was interested in publishing a revised version of the
>> book, starting with the previous publisher who destroyed his stock of
>> the old version...
>
> destroyed?!!!?? that's wild. crazy. unbelievable.
> But that was the french original edition?
>
>>
>> A pity if you ask me :-(
>
> http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html
Careful ! That page seems to be quite ancient. The price quoted there is
"(£40.00/$49.95)" - not what I saw during the ILC07 in the CUP shop.
There webpage quotes $80.00 and £55.00 (but I think I recall an even
higher price ...) - and that's all for the shabby softcover reprint
version.
Cheers, Ralf Mattes
>
> Here is the publishing company and the book 'Principes d'implantation
> de Scheme et Lisp':
>
> http://paracamplus.com/?CGIRunMode=products
>
> 34 Euros is not that expensive given the excellent contents of his
> book(s). Though it is french. ;-)
Ralf Mattes <··@mh-freiburg.de> wrote:
> Careful ! That page seems to be quite ancient. The price quoted there
> is "(£40.00/$49.95)" - not what I saw during the ILC07 in the CUP
> shop. There webpage quotes $80.00 and £55.00 (but I think I recall an
> even higher price ...) - and that's all for the shabby softcover
> reprint version.
No no, the price really is 34 euros. Maybe the price you're referring to
includes shipment.
http://www.lmet.fr/fiche.cgi?9782916466033
--
Read the Jazz Blog !! http://jazzblog.didierverna.com
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bic�tre, France Fax.+33 (1) 53 14 59 22 ······@xemacs.org
On Wed, 18 Apr 2007 14:54:48 +0200, Didier Verna wrote:
> Ralf Mattes <··@mh-freiburg.de> wrote:
>
>> Careful ! That page seems to be quite ancient. The price quoted there
>> is "(£40.00/$49.95)" - not what I saw during the ILC07 in the CUP
>> shop. There webpage quotes $80.00 and £55.00 (but I think I recall an
>> even higher price ...) - and that's all for the shabby softcover
>> reprint version.
>
> No no, the price really is 34 euros. Maybe the price you're referring to
> includes shipment.
>
> http://www.lmet.fr/fiche.cgi?9782916466033
Oh no - I was talking about the price for "Lisp in Small Pieces" from
Cambridge University Press. The prices I quote a from CUP webshop -
Amazon US mentions the same price as lsizt price but sells for $63.20,same
with Amazon UK: list price is the same as CUP, their price is £47.50.
German Amazon quotes the (non-reduced list) US price as a "special price"
and charges whooping 67.50 Euro! And that's all for the paperback.
Cheers, RalfD