Re: newbie: m-expressions



"falcon" <shahbazc@xxxxxxxxx> writes:

> Now I can parse my language and translate it to Lisp...but if there is
> a well thought-out standard way of doing it (I hoped M-Expressions were
> it) then it makes it easier for me.

M-expressions are a footnote in the history of Lisp.

As with everything in Common Lisp, there's no one single way to parse.
There are multiple techniques, vocal advocates of every one, and
battles between them lasting hundreds of messages on c.l.lisp. I know
at least of the following techniques:

- writing lexers by hand;
- writing lexers by hacking the Lisp reader
(see for example http://ftp.linux.org.uk/pub/lisp/cclan/infix.tar.gz);
- writing lexers using the META technique
(http://home.pipeline.com/~hbaker1/Prag-Parse.html)
- writing lexers using regular expressions (http://weitz.de/cl-ppcre/).

- writing parsers by hand (recursive descent, only suitable for LL(1));
- writing parsers using META (I've never seen an example);
- writing parsers using a LALR(1) parser generator
(I'm partial to http://www.pps.jussieu.fr/~jch/software/cl-yacc/).

And of course there's the solution of using XML and usint a nonvali-
dating XML parser.

Juliusz
.