[antlr-interest] C++ parser usage ideas
Sohail Somani
sohail at taggedtype.net
Wed Oct 12 20:19:18 PDT 2005
On Wed, 2005-12-10 at 22:58 -0400, Jim Crafton wrote:
> Has anyone done anything like this? Is there a better way to tackle
> this? Is there a way to modify the orignal C++ grammar to just skip
> over the macros entirely (this would be great, as it would get around
> the whole issue). Apologies if this isn't strictly antlr specific, and
> if it's inapropriate, just let me know.
You might try getting the macro library to do this:
not preprocessed:
#define SOME_MACRO \
{\
line1(); \
line2(); \
}
// the following is at line n
int main() SOME_MACRO
have the library replace it with:
int main()
#line n
{
#line n
line1();
#line n
line2();
#line n
}
Then use this information in your AST?
I don't know how hard it would be.
Sohail
More information about the antlr-interest
mailing list