Yet another Expression Parser

Why Yet another expression parser and interpreter  amidst of plethora of tools and technology? coz i did not find simple and powerful  in .net c#. Nevertheless to mention ANTLR coz i am big fan of it till i come across Irony Irony is a development kit for implementing languages on .NET platform. Hence, i decided to choose this one for one of the use case to play around with it. It is a beautiful journey.

Unlike other LALR parser, writing grammar in Irony is entirely pleasant experience trust me. Writing a expression grammar is just less than 20 lines of c# code. No existing computer algorithm knowledge required and everything is c# classes. If you are new to compiler and interpreter world here is the nice tutorial

Besides writing compiler, writing interpreter is quiet trivial using Irony, coz Irnoy provide the AST after parsing the text and intercepting AST is quiet simple using C#. In this tutorial it is very evident that how simple is to write a compiler for query expression and interpreter. Believe me the interpreter is truly trivial for learning purpose and lots of scope for improvement.

use case:

  1.  Given Expression “( a=b and b=c (d!=e) or e contains ‘test’ )” IT should parse and Provide Syntax Error if any Otherwise provide AST.
  2.  Given AST user can write their own interpretation to transform the above expression to on their own.


  • Input : “( a=b and b=c (d!=e) or e contains ‘test’ )”
  • Output : where ( a=b and b=c (d!=e) or e like’test’ )




Below sample UI which uses the parser to its capability, in this it shows the syntax error. Next it shows the final interpreter result.

expression parser

expression parser