|A handful of LISP questions email@example.com (tactics) (2007-06-19)|
|Re: A handful of LISP questions firstname.lastname@example.org (Gene) (2007-06-19)|
|Re: A handful of LISP questions email@example.com (Nils M Holm) (2007-06-19)|
|Re: A handful of LISP questions firstname.lastname@example.org (Martin Rodgers) (2007-06-19)|
|Re: A handful of LISP questions email@example.com (Lieven Marchand) (2007-06-19)|
|Re: A handful of LISP questions firstname.lastname@example.org (Andreas Hinze) (2007-06-19)|
|Re: A handful of LISP questions email@example.com (tactics) (2007-06-20)|
|Re: A handful of LISP questions firstname.lastname@example.org (Gene) (2007-06-20)|
|Date:||Wed, 20 Jun 2007 01:41:42 -0000|
|Posted-Date:||19 Jun 2007 21:52:10 EDT|
> Yes. It's a great exercise.
It sure is! I started off basically copy and pasting Paul Graham's
LISP and changing it into C code. And from there, I was able to
implement first- class functions (dynamic scope though... still need
to figure out lexical from C). I finally got to a critical point a
few weeks ago where I was just able to add feature after feature and
see the results of my project. But I don't like working on messy code,
and so the last week and a half, I have avoided doing anything
> You might enjoy looking at xlisp. http://almy.us/xlisp.html .
> You can learn something about compiling a small lisp with
>  http://t3x.org/bits/s9fes/
 Jones, Lins
Wiley & Sons, 1996
> A complication is the mechanism of read-time macros. For instance, the
I have the ' expanding properly to quote (thank god). However, the
last thing I added was support for quasiquotes and unquotes. I don't
have the ` and , operators working, and that is the big motivation for
me to rewrite my parser. That and because of dotted pairs (which I
don't yet support).
Additionally, my goal is to make a more usable LISP. I come from a
Python background, and I would like to make a language with very
clean, elegant syntax. I like what ' ` and , do for LISP, and I want
to add more of it where it is appropriate. And because of that, I need
a very clean way to make changes to the language's grammar.
>> In either case, what is the best way to ensure I still have access to
>> the current environment?
>What do you mean by this?
Let me rephrase. When garbage collecting with Mark and Sweep, you need
a root set of objects. This is the set of objects in immediate view of
the program. For example, the objects on the call stack or in the
current environment. I guess from what people have told me on this
list is that you call the collector at the start of the eval function
when memory exceeds a threshold. Then, in that case, do I just flag
everything in the current environment as being part of the root set?
> Do you want to implement a Lisp-1 (like Scheme) or Lisp-2 (like Common
Oh god, lisp-1 please. I am not friends with Common Lisp. It reminds
me of perl with parentheses =-) Again, I'm looking for elegance, so
I'm going to have a strong biased towards the Scheme ends of things.
> However, if you seriously want to write a lisp interpreter then you
should have a look into "Lisp in small pieces" by Queinnec & Callaway
I actually purchased this book a week and a half ago. It is very
interesting. It is a bit tricky at some parts though, and requires
you to have a fair understand the concepts in question. The part about
continuations completely blew me away (as I had never used call/cc
before). But I'll keep at it, even if it takes me a while.
Thank you everyone who replied. You have all been very helpful. I hope
to make good progress with this over the next few months... or
whenever I have time =-)
Return to the
Search the comp.compilers archives again.