I have a tree grammar, part of the grammar is shown below
transitions
:'transitions' '=' INT ('(' INT ',' INT ')') + ';' -> ^(TRANSITIONS INT INT INT*)
;
and here is the respective part of the tree parser grammar,
transitions
:^(TRANSITIONS INT INT INT*)
{System.out.println("");}
;
I have used + rewrite rule and that is basically repitition. In the grammar above, the user is entering minimum 3 integer values, say one possible input,
transitions 1 (5,0)
2nd possible input
transitions 2 (5,0) (5,1)
3rd possible input
transitions 3 (5,0) (5,1) (5,2)
and so on.
The first integer determines how many pairs of integers there will be. The problem is how will I access these integer inputs in my parser grammar and how can I possibly print these in the println statement above?
Please refer to my question ANTLR java test file can't create object of tree grammar for the complete grammar I have written.