Introduction In part two of this series we built an expression evaluator capable of parsing expressions with parentheses. In this part we are going to add support for expression with variables.
Introduction In previous post I showed how to build a simple expression evaluator using expression trees. Although it works fine it has some drawbacks:
It does not support parentheses. It does not support variables. In some cases the result can be wrong as the parser is not using left to right parsing. It is compiling delegates for every expression which results in slower execution. To solve these issues we will use a different algorithm and deal with all points except variable support.
Introduction This is first part of a series about writing expression evaluator in C#. Even though there are several of them available already I decided to write my own as this one is based on expression trees and is very simple. The evaluator supports numeric expressions as well as expression with parameters.