[Mono-list] RE: Compilers emitting parsetrees
John Zedlewski
zedlwski@Princeton.EDU
Tue, 10 Jul 2001 21:39:47 -0400
Bob Salita mentioned the possibility of a "compiler" that simply emits a
parse tree and leaves all the code generation to a separate process, so
I thought I'd send over some links relative to that discussion.
Modularization is, of course, very important in a compiler, but I think
we shouldn't estimate the extent to which others have tried this.
- GCC's internal tree representation is unwieldy, but it's also quite
powerful. See: http://www.ncsa.uiuc.edu/~wendling/tree.html for a great
introduction to the structures involved. The back-end technically runs
in the same process as the front-end, but it does simply walk this tree
and emit code.
If you're looking for a human-readable form of this tree, try:
http://sourceforge.net/projects/introspector/.
- JavaML is also a nice, human-readable format. It works at a higher
level, so it's much more easily readable by people. See:
http://www.cs.washington.edu/homes/gjb/JavaML/
- SUIF is a compiler framework designed for really, really intense
optimizations with total separation of front-end and back-end. It's
incredibly comprehensive, and it includes a whole toolkit for writing
new compiler passes. These passes aren't necessarily just a language
front-end or processor back-end, they can fit into the middle and do
crazy optimizations or transformations. Because it tries to be so
comprehensive, though, SUIF gets really complicated. See:
http://suif.stanford.edu/.
- In the end, there's really not much difference between the
"information rich parsetrees" and the IL itself. After all, nobody said
back-ends needed to operate on trees, and the IL satisfied the criteria
of being language-independent and platform independent.
--JRZ