[antlr-interest] (unknown)
franck_antibes_fr
caronfranck at yahoo.fr
Thu May 15 07:59:14 PDT 2003
Hi,
I am writing a verilog parser based on the grammar found on antlr.org.
but I have to handle in my parser `define macros and `ifdef `else
`endif compiler directive. ( I do not want to preprocess the file).
for the people that know nothing about verilog, the problem is the
same as #define and #ifdef #else #endif preprocessor directive in
C/C++ so I will transpose the problem in C++ instead of verilog.
a litle example
#ifdef CAN_DERIVE
#include "base.h"
class toto : public base {
public:
toto(int a):base(a){}
#else
class toto {
protected:
int a_;
public:
toto(int a):a_(a){}
#endif
virtual get_a() {return a_;}
};
because #ifdef ... can be everywhere in the code, it is not feasable
to put everywhere in the grammar rules to handle this. I thought to
use a king of tokenstream filter or multiplexer with several parsers.
Do any one have an idea to solve this ?
thanks
Franck
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list