Dear all,

I have a grammar for a fairly small and simple language that I have created for 
our project. Once every command in this language is parsed through this 
grammar, a Java object is returned. Everything is working fine.

Now, I have a requirement to read all the available rules/commands of the 
language (I am only interested in the command/rule names). In order to do so, I 
have been trying to get the AST tree working by adding options to my grammar 
for AST tree. For some reason, when I add these options to my grammar, I am 
getting compilation error complaining that my grammar rules cannot return any 
Java objects! Can I have commands/rules of my grammar return some Java objects 
and at the same time be able to build an AST tree off of my grammar?

Is there an easy way to read these grammar command/rule names using antlr 
runtime API's?

Any code sample out there that shows how do to the above (namely returning 
objects from grammar rules and building the tree at the same time)?

Any help here would be greatly appreciate.
_______________________________________________
antlr-dev mailing list
antlr-dev@antlr.org
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to