[antlr-interest] ANTLR3C 3.4 Usage of Parser

Paxi coder at paxi.at
Mon Jul 16 05:37:59 PDT 2012


I encountered this thread at Stackoverflow in the meanwhile that states the
JS grammar I´m using does no create a correct AST.
http://stackoverflow.com/questions/3801658/using-antlr-to-identify-global-variable-declarations-in-a-javascript-file 
I did the changes mentioned there already in my grammar file but i still
cant walk the AST :/
Starting at the "program" rule i always get a tree with no child elements
pProgram prog = &(m_pParser->program(m_pParser));
pANTLR3_BASE_TREE c1 = (pANTLR3_BASE_TREE) prog->tree->super;
pANTLR3_BASE_TREE c1 = (pANTLR3_BASE_TREE) prog->tree;
tried with using the super field and the tree directly but none works.

Starting at the "statement" rule gives me at least a valid root node but
furthermore the results are also not as expected (which would be clear if
ANTLR3 only parses one statement and ends after it, but thats why i want to
start at the program rule...)

Please give me some hints, I really need some help on this since i should
finish it next week and I already read a lot through several topics here and
the docs.

--
View this message in context: http://antlr.1301665.n2.nabble.com/ANTLR3C-3-4-Usage-of-Parser-tp7578377p7578394.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list