Hello
I finally decided to release the source code of this prototype
implementation of a Lisp Interpreter hoping it may serve as an example
(or counter example maybe) for students and "lifetime students" who
are curious about how a Lisp interpreter could be implemented
cool thanks. it would be even nicer if you wrote what functions it
supports.
··········@yahoo.fr wrote:
> Hello
>
> I finally decided to release the source code of this prototype
> implementation of a Lisp Interpreter hoping it may serve as an example
> (or counter example maybe) for students and "lifetime students" who
> are curious about how a Lisp interpreter could be implemented
On Sep 17, 11:03 am, Slobodan Blazeski <·················@gmail.com>
wrote:
> cool thanks. it would be even nicer if you wrote what functions it
> supports.
Hello
Here is the list of 54 implemented functions (not fully support eg no
error handling):
DEFMACRO AND FUNCTIONP CAR * + LOAD IMPLEMENTED / POP QUOTE THIRD
FUNCTION LISTP FIRST FIFTH OR TRACE GETF SYMBOL-FUNCTION NOT HELP CONS
ED CDR DEFUN EVAL APPLY NULL INTEGERP EXIT PUSH SYSTEM SLEEP REVERSE -
UNTRACE SECOND QUIT MEMSTAT FORMAT FBOUNDP TEST BYE LIST PROGN CONSP
READ DEFVAR < > FOURTH IF EQL
This list is generated by wishlisp interpreter when you type
(implemented), this is described in (help)
BR
michel Kern
P� Wed, 17 Sep 2008 11:03:16 +0200, skrev Slobodan Blazeski
<·················@gmail.com>:
> cool thanks. it would be even nicer if you wrote what functions it
> supports.
www.wishlisp.com
--------------
John Thingstad
On Sep 16, 4:27 pm, ··········@yahoo.fr wrote:
> Hello
>
> I finally decided to release the source code of this prototype
> implementation of a Lisp Interpreter hoping it may serve as an example
> (or counter example maybe) for students and "lifetime students" who
> are curious about how a Lisp interpreter could be implemented
I know very little Lisp, but I'm getting what I think are some strange
results. Here's a copy from the shell:
> (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
FACTORIAL
> (factorial 5)
120
> (factorial 120)
0
> (factorial 100)
0
> (factorial 50)
0
> (factorial 25)
2076180480
> (factorial 37)
0
> (factorial 31)
738197504
> (factorial 34)
0
> (factorial 33)
-2147483648
> (factorial 32)
-2147483648
> (factorial 31)
738197504
> (factorial 30)
1409286144
> (factorial 29)
-1241513984
> (factorial 28)
-1375731712
> (factorial 27)
1484783616
> (factorial 26)
-1853882368
> (factorial 25)
2076180480
Here's something similar from Clisp:
[1]> (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
FACTORIAL
[2]> (factorial 31)
8222838654177922817725562880000000
Steve
P� Wed, 17 Sep 2008 20:21:03 +0200, skrev Steve Graham
<···················@gmail.com>:
> On Sep 16, 4:27�pm, ··········@yahoo.fr wrote:
>> Hello
>>
>> I finally decided to release the source code of this prototype
>> implementation of a Lisp Interpreter hoping it may serve as an example
>> (or counter example maybe) for students and "lifetime students" who
>> are curious about how a Lisp interpreter could be implemented
>
> I know very little Lisp, but I'm getting what I think are some strange
> results. Here's a copy from the shell:
>
>> (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
> FACTORIAL
>> (factorial 5)
> 120
>> (factorial 120)
> 0
...
> -1241513984
>> (factorial 28)
> -1375731712
>> (factorial 27)
> 1484783616
>> (factorial 26)
> -1853882368
>> (factorial 25)
> 2076180480
>
>
> Here's something similar from Clisp:
> [1]> (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
> FACTORIAL
> [2]> (factorial 31)
> 8222838654177922817725562880000000
>
>
> Steve
CL-USER 40 > (rem (fact 25) (expt 2 32))
2076180480
Which looks suspiciously like the result above.
Clearly the implementation doesn't support bignum. Thus you are stuck with
the 32 bit register size.
For large multiplications C# just wraps around leading to these strange
values.
--------------
John Thingstad
My one's moved on a bit too. It's slow enough to be laughable, but at
least the source is fairly small and hopefully understandable.
As with wishLisp, I hope this provides a shining example of how to
write a slow implementation of lisp in javascript.
http://code.google.com/p/lispyj/source/browse/trunk/modules/evaluation_module.js
Go to line 228 for the lisp code itself.
On Sep 17, 9:11 pm, "John Thingstad" <·······@online.no> wrote:
> På Wed, 17 Sep 2008 20:21:03 +0200, skrev Steve Graham
> <···················@gmail.com>:
>
>
>
>
>
>
>
> > On Sep 16, 4:27 pm, ··········@yahoo.fr wrote:
> >> Hello
>
> >> I finally decided to release the source code of this prototype
> >> implementation of a Lisp Interpreter hoping it may serve as an example
> >> (or counter example maybe) for students and "lifetime students" who
> >> are curious about how a Lisp interpreter could be implemented
>
> > I know very little Lisp, but I'm getting what I think are some strange
> > results. Here's a copy from the shell:
>
> >> (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
> > FACTORIAL
> >> (factorial 5)
> > 120
> >> (factorial 120)
> > 0
> ...
> > -1241513984
> >> (factorial 28)
> > -1375731712
> >> (factorial 27)
> > 1484783616
> >> (factorial 26)
> > -1853882368
> >> (factorial 25)
> > 2076180480
>
> > Here's something similar from Clisp:
> > [1]> (defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
> > FACTORIAL
> > [2]> (factorial 31)
> > 8222838654177922817725562880000000
>
> > Steve
>
> CL-USER 40 > (rem (fact 25) (expt 2 32))
> 2076180480
>
> Which looks suspiciously like the result above.
>
> Clearly the implementation doesn't support bignum. Thus you are stuck with
> the 32 bit register size.
> For large multiplications C# just wraps around leading to these strange
> values.
>
> --------------
> John Thingstad- Hide quoted text -
>
> - Show quoted text -
Hello
Thanks for the feedback, I confess this "bignum" feature I was not
even aware of it and I guess it is by this kind of feature that Lisp
is beyond the more common languages like C# and Java. As this project
is enough interesting to generate feedback from people more educated
in the Lisp implementation than myself, I would like to ask where I
can find the "core functions" as many sources explain that lisp is
bootstrapped and many functions are in fact written in Lisp so where I
can fond the list of these core functions as well as the lisp source
of lisp functions written on top of the core. There is such a thing at
http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp (and in the book
'ANSI Common Lisp') but I seems more an example rather than a complete
'Lisp in Lisp' source
P� Fri, 19 Sep 2008 15:19:24 +0200, skrev <··········@yahoo.fr>:
>
> Hello
>
> Thanks for the feedback, I confess this "bignum" feature I was not
> even aware of it and I guess it is by this kind of feature that Lisp
> is beyond the more common languages like C# and Java.
Not exactly. Big number arithmetric is available as a seperate library.
There just isn't any check than automatically converts the number to a
bignum if it overflows. Or for that matter any check for overflow at all.
> As this project
> is enough interesting to generate feedback from people more educated
> in the Lisp implementation than myself, I would like to ask where I
> can find the "core functions" as many sources explain that lisp is
> bootstrapped and many functions are in fact written in Lisp so where I
> can fond the list of these core functions as well as the lisp source
> of lisp functions written on top of the core. There is such a thing at
> http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp (and in the book
> 'ANSI Common Lisp') but I seems more an example rather than a complete
> 'Lisp in Lisp' source
Implementing a full Common Lisp is complicated. If you don't understand
and have experience with CL you will probaly get it wrong. "Lisp in small
pieces" by Quinnebeck is a 'classic' description of the workings of Lisp.
It mostly describes implementation of Scheme, but Common Lisp features are
also explained. It starts with a interprenter, then goes on to a formal
description and finally decribes how to write a compiler. Not for the
faint of heart though. Read "Structured Introduction to computer
Programming" by Abelson, Sussman, and Sussman first[1]. "Paradigms in AI
programming" by Peter Norvig also has a couple of chapters where he
implements a simple Scheme. (And it's a good book on programming Lisp in
general.)
The full soruce code of Corman CL, SBCL an Clozure CL are availabe. The
final word is "The Common Lisp Hyperspec".
[1] SICP is available online at http://mitpress.mit.edu/sicp/.There are
also some video lectures from a cource using the book at MIT at
http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/.
--------------
John Thingstad
From: Raffael Cavallaro
Subject: Re: wishLisp new version (0.1.3.6) with Source Code
Date:
Message-ID: <gb0knm$42m$1@aioe.org>
On 2008-09-19 11:44:37 -0400, "John Thingstad" <·······@online.no> said:
> "Lisp in small pieces" by Quinnebeck is a 'classic' description of the
> workings of Lisp.
Queinnec
<http://www.cambridge.org/catalogue/catalogue.asp?isbn=0521545668>
<http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/dp/0521545668/ref=sr_11_1?ie=UTF8&qid=1221842397&sr=11-1>
From: Paul Donnelly
Subject: Re: wishLisp new version (0.1.3.6) with Source Code
Date:
Message-ID: <873ajvde5g.fsf@plap.localdomain>
"John Thingstad" <·······@online.no> writes:
> På Fri, 19 Sep 2008 15:19:24 +0200, skrev <··········@yahoo.fr>:
>
>>
>> Hello
>>
>> Thanks for the feedback, I confess this "bignum" feature I was not
>> even aware of it and I guess it is by this kind of feature that Lisp
>> is beyond the more common languages like C# and Java.
>
> Not exactly. Big number arithmetric is available as a seperate
> library. There just isn't any check than automatically converts the
> number to a bignum if it overflows. Or for that matter any check for
> overflow at all.
>
>> As this project
>> is enough interesting to generate feedback from people more educated
>> in the Lisp implementation than myself, I would like to ask where I
>> can find the "core functions" as many sources explain that lisp is
>> bootstrapped and many functions are in fact written in Lisp so where I
>> can fond the list of these core functions as well as the lisp source
>> of lisp functions written on top of the core. There is such a thing at
>> http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp (and in the book
>> 'ANSI Common Lisp') but I seems more an example rather than a complete
>> 'Lisp in Lisp' source
>
> Implementing a full Common Lisp is complicated. If you don't
> understand and have experience with CL you will probaly get it
> wrong. "Lisp in small pieces" by Quinnebeck is a 'classic'
> description of the workings of Lisp. It mostly describes
> implementation of Scheme, but Common Lisp features are also
> explained. It starts with a interprenter, then goes on to a formal
> description and finally decribes how to write a compiler. Not for the
> faint of heart though. Read "Structured Introduction to computer
> Programming" by Abelson, Sussman, and Sussman first[1].
Do you mean "Structure and Interpretation of Computer Programs"?
On Sep 19, 5:44 pm, "John Thingstad" <·······@online.no> wrote:
> På Fri, 19 Sep 2008 15:19:24 +0200, skrev <··········@yahoo.fr>:
>
>
>
> > Hello
>
> > Thanks for the feedback, I confess this "bignum" feature I was not
> > even aware of it and I guess it is by this kind of feature that Lisp
> > is beyond the more common languages like C# and Java.
>
> Not exactly. Big number arithmetric is available as a seperate library.
> There just isn't any check than automatically converts the number to a
> bignum if it overflows. Or for that matter any check for overflow at all.
>
> > As this project
> > is enough interesting to generate feedback from people more educated
> > in the Lisp implementation than myself, I would like to ask where I
> > can find the "core functions" as many sources explain that lisp is
> > bootstrapped and many functions are in fact written in Lisp so where I
> > can fond the list of these core functions as well as the lisp source
> > of lisp functions written on top of the core. There is such a thing at
> >http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp(and in the book
> > 'ANSI Common Lisp') but I seems more an example rather than a complete
> > 'Lisp in Lisp' source
>
> Implementing a full Common Lisp is complicated. If you don't understand
> and have experience with CL you will probaly get it wrong. "Lisp in small
> pieces" by Quinnebeck is a 'classic' description of the workings of Lisp.
> It mostly describes implementation of Scheme, but Common Lisp features are
> also explained. It starts with a interprenter, then goes on to a formal
> description and finally decribes how to write a compiler. Not for the
> faint of heart though. Read "Structured Introduction to computer
> Programming" by Abelson, Sussman, and Sussman first[1]. "Paradigms in AI
> programming" by Peter Norvig also has a couple of chapters where he
> implements a simple Scheme. (And it's a good book on programming Lisp in
> general.)
> The full soruce code of Corman CL, SBCL an Clozure CL are availabe. The
> final word is "The Common Lisp Hyperspec".
>
> [1] SICP is available online athttp://mitpress.mit.edu/sicp/.Thereare
> also some video lectures from a cource using the book at MIT at http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/.
>
> --------------
> John Thingstad
http://library.readscheme.org/page1.html
Guy Lewis Steele, Jr. and Gerald Jay Sussman. "The Art of the
Interpreter (excellent just finishing it)
Guy Lewis Steele, Jr.. "RABBIT: A Compiler for SCHEME". (next on my
read list)
bobi
On Tue, 16 Sep 2008 15:27:14 -0700, kernmichel wrote:
> Hello
>
> I finally decided to release the source code of this prototype
> implementation of a Lisp Interpreter hoping it may serve as an example
> (or counter example maybe) for students and "lifetime students" who are
> curious about how a Lisp interpreter could be implemented
I also recently noticed ClearLisp (http://www.xs4all.nl/~tolenaar/
page3.html) which is another interpreter written C#. It's Common Lisp-y,
including generic functions, but has some incompatible extensions for
"convenience".
Matt