[antlr-interest] ANTLR 3.0 tree construction proposal

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Wed Feb 2 11:36:25 PST 2005


At 11:18 AM 2/2/2005, John D. Mitchell wrote:
> >>>>> "Loring" == Loring Craymer <Loring.G.Craymer at jpl.nasa.gov> writes:
> >>>>>> At 09:29 AM 2/2/2005, John D. Mitchell wrote:
>[...]
>
> >> Hmm... But that presumes a constructivist approach.  I.e., one would
> >> have to create the phases in order so that this automated tree grammar
> >> would be constructed.  Sometimes, it's much better to e.g., work
> >> backwards from the tree that you want and then determine the (sequence
> >> of) transformations to make that.
>
> > So you sketch backward and then implement forward.  The key is that
> > automatic tree generation makes the implement forward phase very fast (I
> > did tree transformation development for a pretty complete expression
> > grammar in about 2 hours).
>
>Cool.
>
>However, what about the cases where you've already built the system and now
>are going around tweaking it?

Until we get something better, that's what grammar unit (rule-level) tests 
are for.  I've got first cut support for that in 2.8 using Ter's 
ParseTreeDebug stuff extended to handle tree walkers--that's how I test 
tree transformation and automatic tree grammar generation--but that is 
still a bit primitive.  A good mechanism for composing test cases 
hierarchically would help.  [For each Token in a rule, specify the textual 
equivalent; then do recursive substitution for rules that invoke other 
rules.]  That would not be very difficult to implement.  It just takes time ...

--Loring


>Thanks,
>         John




More information about the antlr-interest mailing list