[antlr-interest] How to split int a,b;
Christian Andersson
dt05ca4 at student.lth.se
Mon Oct 1 03:53:29 PDT 2007
---------------------------- Original Message ----------------------------
Subject: How to split int a,b;
From: "Christian Andersson" <dt05ca4 at student.lth.se>
Date: Mon, October 1, 2007 11:38
To: antlr-interest at antlr.org
--------------------------------------------------------------------------
Hi all,
I have this type declaration below:
int a,b;
My simple grammar looks like the following:
vardecl
:type declarator_list ';' ->^(DECL type declarator_list)
;
declarator_list
: ID (',' ID)* ->^(ID)+
;
My problem is that I want to split up int a,b; into two
separate declarations in my AST without moving the declarator_list rule
up to the vardecl rule.
I want this tree:
DECL DECL
| \ | \
int 'a' int 'b'
instead of:
DECL
| \
int List
| \
'a' 'b'
Thanks for any help
BR Christian
More information about the antlr-interest
mailing list