65.9K
CodeProject is changing. Read more.
Home

Parsing - It Is Easy. Base CSharp Classes and Expressions Calculator

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.67/5 (4 votes)

Feb 27, 2008

CPOL
viewsIcon

21072

downloadIcon

318

Provide Base C# parsing classes with demo application and description

Introduction

Sometimes you need to analyze a file and look for a simple parsing solution. For this case, I developed some base classes and wrote a description of how you can make it. As an example, I used expression calculator. It is easy but very powerful sample, I think. For developing your own parser, you only need to write rules for your file and write simple classes based on rules. As input you can use any source but default implementation uses text file. You can get different parts (as variable names, numbers, and e.g.) of your file as output.

The sample application can read expressions from a file or from the text box. Expressions are not only parsed but executed too. So you can use it as the powerful calculator.

In addition, I tried to explain how to create your own parser based on my classes.

You can find more detailed description here.

Feel free to write me a notice if you have a question.