Simple lexical analyzer and parser in C#