views:

240

answers:

2

I want to have a programming competition with a friend of mine in C# and the competition will be to write with the fewest number of C# tokens. I have seen C++ token counting programs around but is there one for C#? Or would there be something in System.Reflection? Additionally, if anyone has links to token counters for other languages, feel free to link them.

A: 

Well I believe that technically anything in the Reflection namespaces won't be a token counter, as everything in Reflection deals with inspection of the IL, which may be optimised for example.

This wikipedia entry might help you however - List of C Sharp lexer generators

Kragen
+3  A: 

Irony (a C# parser) has a C# grammar (i'm not sure which version of C# it supports), and the grammar explorer tool that Irony comes with probably gives you a token count...

If it doesn't, im sure you could make it do so pretty easily (open source ftw)

Rob Fonseca-Ensor