[antlr-interest] C# TARGET ANNOUNCEMENTS

Gavin Lambert antlr at mirality.co.nz
Sat Apr 12 06:03:49 PDT 2008


At 09:16 12/04/2008, Johannes Luber wrote:
 >The templates are different. I can't include in templates C#
 >2.0-specific stuff without ensuring that for C# 1.0 compilers
 >the stuff isn't visibly. One possibility is to use preprocessor
 >directives. The disadvantage is that people have to define the
 >right symbol - something which doesn't seem right to me.

I've occasionally lamented the fact that C# doesn't provide a full 
macro-based preprocessor like C++ -- it would be handy in 
situations like this to be able to use "#if __CSHARP__ >= 
0x00020000" or something.  (Other ones that I've particularly 
wanted include __FILE__ and __DATE__.)  There's also cases where 
code repetition could be reduced significantly if macros could be 
used.

On the other hand, it does make the language easier to read when 
you know that something can't be aliased weirdly to something 
unexpected.  So the C#-ish approach to dealing with the repeated 
code / multiple version issue tends to end up being the use of 
some sort of code generator -- which is basically what ANTLR is 
anyway :)



More information about the antlr-interest mailing list