[antlr-interest] ANTLR for a compiler

iank at bearcave.com iank at bearcave.com
Thu Nov 4 16:55:03 PST 2004



  In my opinion the power of ANTLR is as a parser generator for
  language parsers, not tree parsers.  Given my biases, I'd leave tree
  parsing entirely out of ANTLR.  Automatic tree construction and tree
  parsing seem to have been the source of the majority of problems
  I've seen reported here.  I understand and respect the fact that
  there are other view, I'm just describing mine.

  When I use ANTLR I build a tree of my own design from the parser.
  I build my trees "by hand" (e.g., calling my own tree factory code
  and linking the tree together recursively).  Then I traverse this
  tree using custom tree walker code.  For complex languages (like
  Verilog, for example), multiple passes are necessary (and then there
  are complex issues like elaboration that have to be dealt with).

  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 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.

  Ian Kaplan


 
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