Re: Designing Lisp from scratch
Jaap Weel <[email protected]> Fri, 23 Mar 2007 11:11:05 +0100
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
Daniel,
Let me try to respond to some of your questions and suggestions.
| Why did I choose CL instead of Scheme? Well had I done Scheme, the
| question might have been why I implemented Scheme instead of CL. I
| probably chose CL because I found better tutorials for it, and
| figured that there might be more CL practitioners than Schemers.
In case you are still interested in Scheme (it's *much* easier to
implement), I suggest you have a look at some of the following
books. In particular, I cannot never recommend SICP enough, so I will
not try. (Did I just contradict myself?)
Teach Yourself Scheme in Fixnum Days
http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html
How to Design Programs
http://www.htdp.org/2003-09-26/Book
Structure and Interpretation of Computer Programs (SICP)
http://mitpress.mit.edu/sicp/full-text/book/book.html
Lectures to go with SICP
http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/
| 2. Grammar for languages like Scheme might use symbols that are
| invalid in C, thus causing it not to work with Yacc (conventional C
| implementations of it). I'm not 100 percent sure of this.
I'm 100 per cent sure that, in fact, it will work. Yacc simply takes a
BNF-like description of a context free grammar and transforms it into
a program that parses strings using that grammar. (More particularly,
the grammar has to be LR(1).) The original yacc spat out C, but
variants exist that produce code in other languages.
| I'd like to turn the question around and ask if someone can point me
| to how I'd go about creating Lisp (CL, Scheme, or whatever
| interesting variation) with Lex / Yacc.
You may find it useful to pick up a good compilers book. Last time I
looked for good compilers books on the net (admittedly a while ago), I
did not find any. (There is one floating around that shows you how to
build a one-pass compiler in Pascal. It's no good.) You may have to
buy or borrow an actual dead tree book if you want to learn about
compiler technology. I personally like Appel's "Modern Compiler
Implementation in {C|ML|Java}", which is in various ways more modern
than the traditional "Dragon Book" by Aho, Sethi, and Ullman. Appel's
book will teach you everything you need to implement most common
programming languages in more or less the standard way.
--
/jaap