[antlr-interest] New article on StringTemplates and Treewalkers
sohail at taggedtype.net
sohail at taggedtype.net
Tue Jan 10 14:15:00 PST 2006
>
> On Jan 10, 2006, at 1:14 PM, sohail at taggedtype.net wrote:
>> I was struck by the example of 5 lines of C code being folded into one
>> line of Java code. Why couldn't you have a tree parser do this? It
>> would
>> be inefficient, but I don't know if that is the point of the article.
>
> funcdef
> scope {
> boolean hasReturn;
> }
> @init {
> hasReturn = false;
> }
> : ^(FUNCDEF ID args body) {if ($hasReturn) ...}
> ;
OT for the topic, but why do we have an @init{...} action where before
just {...} would have sufficed? I'm an totally unfamiliar with antlr v3
though :)
More information about the antlr-interest
mailing list