[antlr-interest] how to best break apart multiple assignments
Indhu Bharathi
indhu.b at s7software.com
Wed Apr 1 02:01:50 PDT 2009
How about something like this?
r : (ID EQ)+ INTLIT SEMICOLON -> ^(ASSIGN ID INTLIT)+
;
So, for your example, this will create two subtrees with ASSIGN as root.
The tree generated will be ^(nil ^(ASSIGN Odd 0) ^(ASSIGN Even 0))
And then you can write string template in the tree walker and emit out
as you need.
- Indhu
Bruce Bauman wrote:
> In the sometimes bizarre dialect of Pascal I am using (MetaWare), the following is allowed:
>
> Odd := Even := 0;
>
> I need to split this into:
>
> Odd := 0;
> Even := 0;
>
> Can somebody point me in the right direction?
>
> Thanks.
>
> -- Bruce
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
More information about the antlr-interest
mailing list