[antlr-interest] Re: ANTLR for a compiler

lgcraymer lgc at mail1.jpl.nasa.gov
Thu Nov 4 22:23:13 PST 2004



Burg might be useful for the final passes, but it is not an
all-purpose optimization tool.  lcc used burg, but is not reported to
have achieved great optimization.  My impression is that burg is good
for peephole optimization and the like, but not for the high-level
transformations that can be achieved after dataflow analysis.

--Loring


--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
> Hi Bryan,
> 
> You want JBurg or something similar: a tree walker that is explicitly 
> designed to generate code.  You can have ambiguous patterns with 
> associated costs so that x+1 can be matched either as add one or 
> increment.  here is a lab from my grad course where we generate machine 
> code from an AST:
> 
> http://www.cs.usfca.edu/~parrt/course/652/labs/jburg.html
> 
> For example, I say:
> 
> JBurg descriptions looks like ANTLR tree grammars except that the 
> parentheses are in a different spot (prefix vs postfix notation):
> 
> reg : #(ADD r1:reg r2:reg) {...emit instruction(s)...}
> 
>   and burg and friends use
> 
> reg : ADD(reg r1, reg r2) : 1 {...emit instruction(s)...}
> 
> where : 1 implies cost 1. Costs usually are just relative numbers but 
> can mean "how many instructions were required?"
> 
> ANTLR tree walkers are not designed specifically for instruction 
> selection; rather the opposite. :)  Building actual compilers has never 
> been my focus (unless you count bytecode compilers, which are much 
> easier).
> 
> Terence





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list