Macros[by implementor of toy compiler]

Keith Wansbrough Keith.Wansbrough@cl.cam.ac.uk
Tue, 08 May 2001 16:02:07 +0100


> 2. Macros make the parsed grammar dynamic. Usually compiler has hard-coded
> parser generated by LALR parser generator(like Happy or Yacc) compiled in.
> Introducing each macro like you proposed would need(I think) generating
> new parser(at least for the fragment of the grammar).

Dylan has macros and a syntax more interesting than LISP's, so perhaps 
it would be worth looking at how they handle it.  I forget now, but I 
don't think it was too difficult.

I also considered some of the issues we're discussing in an
unpublished paper that appears on my publications page,

  http://www.cl.cam.ac.uk/~kw217/research/papers.html#Wansbrough99:Macros

(Section 8 looks briefly at Dylan-style macro facilities).

--KW 8-)