[antlr-interest] De-emphasizing tree grammars?

Terence Parr parrt at cs.usfca.edu
Tue Dec 27 11:12:37 PST 2011

On Dec 26, 2011, at 5:45 PM, Voelkel, Andy wrote:

Hi Andy,

> This whole discussion is very welcome and rather exciting. As a relative newcomer to this technology, the direction that v4 seems to be taking nonetheless seems very right to me. I've done two very small projects with ANTLR so far. On the first one, I tried tree grammars since they seemed to be "promoted", on the second I decided to do my own tree walking. They both had advantages, but I ultimately did prefer doing my own tree walking because it allowed me to take greater advantage of the language environment I was using (C# in my case). I also find debugging the tree walking code easier because it isn't a mixed language environment.

Yep. Debugging tree grammars is always been very difficult. Also, explaining how to construct ASTs with either the ^ and ! operators or the -> rewrite syntax has always been challenging, though it makes perfect sense to me ;) When even my graduate students were having trouble, I started questioning my approach.

I also noticed that a number of other parser generators build parse trees and they're very popular with their users.

> It sounds like the new approach with a "callback-like" interface also give me even more flexibility in deciding what data structures to use for my trees, which is even better.

My intuition is that this new approach is a very good one and, most importantly, satisfies my goal of dramatically reducing the steep learning curve associated with previous versions of ANTLR.

> I applaud the open mindedness and flexibility that Terence is showing in changing his approach!

thanks very much for the feedback and hopefully other people will chime in as vacation winds down.

More information about the antlr-interest mailing list