[antlr-interest] Is it necessary to write the 'main' code inside the grammar?

Vishwanath Hawargi vhawargi at gmail.com
Thu Nov 13 15:51:49 PST 2008


Hello,
I am newbie to ANTLR and I am trying to implement a parser.
I wrote a grammar file and the grammar check is fine and i can
successfully generate either java /  c code.

My grammar file has only list of Literals and Parser rules. and to
generate the C code, i have put
                       options { language = Cpp;}

other than these, there are no  more sections.

I am not able to use the generated files now. Couldnt get any  sample
code to use the lexer.c and parser. files.
What do i have to write in the main() ? Can i write one independantly
without writing the @init part in the grammar?
Kindly throw some light on this... treat me as a layman and show me
the steps please!

Also, I am not able to locate C++ include files in the ANTLR site,
could someone help me locate them?
 (trying to change the 'language' to cpp, gives a cpp.stg file error.)

Eventually i want c++ code generated..
please help

thanks.
V


More information about the antlr-interest mailing list