[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Macros and Language Design.
I have been reading this book:
http://www.info.ucl.ac.be/people/PVR/book.html to learn more about the
kinds of programming language features people talk about here. First off,
I'm curious what other people think of this book? So far its been very
helpful to me in clearing up what some people are talking about,
particularly on this list.
They talk about using a "kernel language approach". They have this small
kernel of language, and then, through a parser generator tool, other
constructs are added to the language by translating them into the kernel
language. Is this comparable to what Lisp macros do? A while back, in the
macros discussion, someone(Paul Graham?) mentioned that macros are useful
to the language designer even if they are not exposed in the language, is
this what he was talking about?
Also, to further my understanding of macros, I have some examples of more
complex things I think macros could solve. I'm a senior electrical
engineering student, and we've been doing some VHDL, and for the subset of
the language we're allowed to use, its rather tedious to write finite state
machines. So I wrote a program, in C, to take a transition list of the
Finite State Machine and translate it into VHDL(with usually a 10-20x
increase in the lines of code from the transition table to the VHDL). A
friend of mine uses a Java tool called Torque to generate code for his a
lot of his database work in a project of his. Are these the kinds of things
the reason Lisp programmers love macros? Are they are replacement for code
generators, except fully integrated(or not) into the language, so that
none/fewer of the problems of code generators are encountered? Am I missing
the point, or anything else for that matter?
Matt Estes