Re: A handful of LISP questions

tactics <>
Wed, 20 Jun 2007 01:41:42 -0000

          From comp.compilers

Related articles
A handful of LISP questions (tactics) (2007-06-19)
Re: A handful of LISP questions (Gene) (2007-06-19)
Re: A handful of LISP questions (Nils M Holm) (2007-06-19)
Re: A handful of LISP questions (Martin Rodgers) (2007-06-19)
Re: A handful of LISP questions (Lieven Marchand) (2007-06-19)
Re: A handful of LISP questions (Andreas Hinze) (2007-06-19)
Re: A handful of LISP questions (tactics) (2007-06-20)
Re: A handful of LISP questions (Gene) (2007-06-20)
| List of all articles for this month |

From: tactics <>
Newsgroups: comp.compilers
Date: Wed, 20 Jun 2007 01:41:42 -0000
Organization: Compilers Central
References: 07-06-03307-06-043
Keywords: Lisp
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. .
> You can learn something about compiling a small lisp with

> [1]
[2] Jones, Lins
                "Garbage Collection"
                Wiley & Sons, 1996


> A complication is the mechanism of read-time macros. For instance, the
QUOTE facility.

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
Lisp) ?

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 =-)

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.