[antlr-interest] Moving from SableCC to ANTLR; What are tree grammars?

Tyler Distad tyler.distad at gmail.com
Sat Apr 3 20:27:23 PDT 2010


Sir,

On Sat, Apr 3, 2010 at 11:01 PM, Andreas Stefik <stefika at gmail.com> wrote:

> On Sat, Apr 3, 2010 at 8:21 PM, Tyler Distad <tyler.distad at gmail.com>
> wrote:
> > My Computer Science professor has taught his Compiler course with SableCC
> > for years. I am investigating moving the class to ANTLR.
> >
>
> As a professor that teaches compilers myself on occasion, I would
> highly recommend the change.
>

Thanks for your thorough response. I'm encouraged by your enthusiasm and
familiarity with ANTLR. I'm sure that as I continue to dig more deeply into
this project, I'll come up with more burning questions. For now, however,
I've been satisfied, and reassured that I'm really not going crazy.

Thanks again.

Tyler Distad

In sum, here's a few advantages:
>
> 1. Visualization of DFAs and CFGs is extremely helpful, for students
> (and myself sometimes, honestly, when I get stuck on a tricky rule)
> 2. Visualizations include the ability to analyze grammar conflicts ---
> also very handy
> 3. LL star instead of LL k (like JavaCC --- Sable CC is LALR k if I
> recall correctly)
> 4. Semantic and Syntactic predicates make writing very complex
> grammars much easier than with traditional parsers
> 5. Tree grammars more or less get rid of the visitor pattern, which I
> strongly prefer. I understand the visitor pattern very, very, well,
> and have written compilers with it, but it drives me crazy sometimes.
> 6. Extremely excellent documentation, especially Terrence's books. I
> haven't read the new one yet, but compared to most compiler books on
> the market, Terrence's ANTLR book was a real breath of fresh air.
>
> And here's some disadvantages:
>
> 1. Some of my students find writing certain rules in an LL grammar
> more difficult than LALR, especially expressions.
> 2. Some of the ANTLR syntax/semantics is pretty non-intuitive for
> students. I'm thinking specifically of rewrite rules like ^(NODE
> OTHER_NODE), or a few other things. That isn't to say that things are
> any easier in SableCC/JavaCC/Lex/Yacc, or any other language, as they
> aren't, but still ...
>


More information about the antlr-interest mailing list