Jim, thanks! I'll try that. Yes, I'm trying to build a C# antlr grammar.
It's a learning exercise at the moment. I'm hoping to open source it so I
don't want to be peeking at any commercial code but I'd love to pick your
brain! :)

How did you implement the pre-processor? To embed the language grammar in
the pre-processor grammar I created a subclass of a C# TextReader that looks
for lines starting with # and then hands those lines off to a pre-processor
grammar to determine if the block of code should be returned to the language
parser. This way the TextReader is generating only the text that is not
#ifdefed out. I tried to create a unified grammar but failed. Did you manage
to have a unified pre-processor and language grammar?

For my 2c I like Scott's proposal. Build a lexer that generates tokens given
(1) a lexical grammar and (2) the set of possible tokens the parser could
consume. Seems that would be an especially elegant way to embed one grammar
(C#) in another (C# pre-processor) as well the keyword context problem.

Thanks,
Chris

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