[antlr-interest] "An Introduction to ANTLR" presentation slides

Gerald B. Rosenberg gbr at newtechlaw.com
Fri Feb 29 12:01:23 PST 2008


At 10:38 AM 2/29/2008, you wrote:
>Gerald B. Rosenberg wrote:
>>Not really.   Consider the statements:
>>
>>do { X } while (Y);
>>while (Y) { X } ;
>>
>>They are syntactically different -- reflecting static structure.
>But in both cases, a treewalker would get the same AST.

Could.

>So this is a good example of the common usage of the term "syntax". We all
>agree that these two are "syntactially different", and yet to a treewalker's
>"syntactic predicate", they are identical.

Even if they were represented as the same sub-tree, whether it could 
be unrolled or further transformed in some other way could be 
dependent on surrounding syntax.  Or, for that matter, dependent on 
the internal syntax of the X sub-tree.

>That, to me, means that having a treewalker construct with a name containing
>the word "syntax" (or derivative) doesn't make sense.

So, it would be entirely valid for a syntactic predicate to consider 
the surrounding or internal syntax of a sub-tree in deciding on a 
"correct" production, even in a treewalker.

>And with that, I'll drop it.

Best,
Gerald 



More information about the antlr-interest mailing list