Download the software source and code to create a parser in C#
One of the more difficult tasks in computer science is building parsers and compilers. There are many tools available to help with this tedious task, most notably Flex and Yacc, both of which are available on the Linux/Unix platform. The program that I present here in this article is called TokenIcer. It's similar to Flex, but TokenIcer provides an easy-to-use GUI that serves as your rules editor as well as a test bed for testing your rules. Additionally, once your parsing rules are defined, TokenIcer can create a parser class, based on your rules, in C# or VB.NET.
To be able to use TokenIcer well, you need to have a good understanding of how regular expressions work. Every rule you enter in TokenIcer will be based on a regular expression. Any regular expression that the .NET Regex library can parse will also be valid in TokenIcer.
The way the parser works, and also the way TokenIcer will work, is that you feed some sort of input string to the parser. For example, if we enter the following line into a parser:
3+2 * (6 + 1)
We should expect our parser to give us outputs like this:
What we do with this parser output depends on exactly what we want to do. Maybe you're building a language compiler or maybe a math parser. This is what TokenIcer does. It takes input like "3+2 * (6 + 1)" and converts it to an array of enumerated values.
Dear user, you will be offered a download