Hi,

What do you think would be the best approach to solve macro substitution with 
ANTLR?

One option I've seen is to build it in the lexer. I've seen a sample grammar 
for a C preprocessor on the website, but I didn't go in detail into it. My 
language is not C, but a custom language that resembles more to Java.

Another option I'm thinking of is to do the macro replacement after the AST is 
built? Basically walk over the tree, detect macro patterns in the subtrees and 
do needed replacements. But this one sounds messy, with all the involved node 
manipulations.

Another one would be to integrate some external framework. For example there is 
the GNU M4 framework. Don't know if there is something similar that can be 
easily plugged into ANTLR.

If someone has experience with macro handling, I could use any suggestion.

Thanks,
Gabi.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to