[antlr-interest] ANTLR for a compiler

Bryan Ewbank ewbank at synopsys.com
Fri Nov 5 08:21:41 PST 2004


>   I think that your comment about being frustrated with ANTLR and
>   using Bison instead will not be very productive for you.  To me the
>   advantages of an ANTLR parser compared to Bison are huge.  Going to
>   Bison will not help with your tree walker issue, as far as I can
>   see.  In using Bison you will simply be making a choice to use
>   technology that is over 25 years old, rather than technology
>   developed within the last decade.  I would not willingly use
>   YACC/Bison ever again.  I've done enough YACC grammar debugging for
>   one lifetime.

I agree completely; Bison isn't that bad - it pays the bills - but ANTLR
does a bit more with just a parser.

The trade off is more in the nature of a business decision.  If I'm only
using ANTLR for the parser/scanner, then the benefit is not nearly
what it would be most of the passes are treeparsers.

>   I think that it might help to step back from your software and work
>   on the design of your compiler passes.  Do not be afraid of multiple
>   passes over internal trees.  In most cases they are not that time
>   consuming.

That's the plan, and is also the pain.  Each of those tree-parsers requires
a complete set of rules to describe the tree being passed from the previous
phase - the content of the tree changes as it flows down the pipeline, so
there isn't "just one tree type".

For example, the tree before normalization might have "(= x (+ x 1))" as
well as "(++ x)",
but after normalization there will be no "++" nodes.   Therefore, passes
after that
normalization should report "++" nodes as errors.  Similarly, one pass will
remove all
nodes of a certain type by normalizing the children - so passes after that
one will not
see the same tree node types as those before it.

Ah well, I'll read through the responses and see what the wisdom of the
informed can tell me.  Sorry to share my bad day :-(



 
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