[antlr-interest] help: scanning multiple lines of input

Gavin Lambert antlr at mirality.co.nz
Thu Sep 13 00:36:56 PDT 2007


At 17:19 13/09/2007, atif azad wrote:
 >and output i get is like this
 >
 >tree: (DECL add r2) (DECL store r2 r2)
 >text r2
 >type add
 >
 >But I want output like this
 >
 >tree: (DECL add r2) (DECL store r2 r2)
 >text r2
 >type add
 >text r2 r2
 >type store
[...]
 >		langDumpDecl walker = new langDumpDecl(nodes);
 >		walker.decl();

Assuming that the "decl" rule matches one DECL-rooted tree, the 
problem would be that you're only calling it once, and hence only 
recognising one DECL tree.

Either call it in a loop or just create a new rule containing 
decl* or decl+ and call that in your Main instead (depending on 
what you want to do with it).



More information about the antlr-interest mailing list