[antlr-interest] Collecting disparate subtrees into one tree?
jared.bunting at peachjean.com
jared.bunting at peachjean.com
Wed Jul 1 05:06:32 PDT 2009
It's been awhile since I've written grammars, but what about:
code: (proc | func)*
-> ^(CODE ^(PROCS proc*) ^(FUNCS func*))
I seem to recall that this works fairly well...
------Original Message------
From: J. Stephen Riley Silber
Sender: antlr-interest-bounces at antlr.org
To: Damien Cassou
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Collecting disparate subtrees into one tree?
Sent: Jul 1, 2009 7:00 AM
Hi Damien,
> doesn't something like this work?
>
> code: procs* funcs*
> -> ^(CODE ^(PROCS procs*) ^(FUNCS funcs*))
>
I don't think it would, because it still requires that procs be grouped together in the source code, as well as funcs. Something like
code: (proc | func)*
would be more accurate, but then I still have my same tree problem.
Though your idea did trigger some vague notion in my brain meaties that maybe I can do a combo top-down and bottom-up visitor to bubble procs and funcs apart... I'll have to think about this.
Other ideas?
--S
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
Sent via BlackBerry by AT&T
More information about the antlr-interest
mailing list