The Freak Parade

Strange noises from the mind of Nathan Stults…
  • rss
  • Home
  • About The Freak Parade

Simple Expression Evaluator project now on CodePlex

August 28, 2008

I have uploaded a new project, Simple Expression Evaluator, to Codeplex. I haven’t had time to create any documentation imageyet, but as usual the project contains unit tests and a sample application to play with. Simple Expression Evaluator abstracts the the parser+compiler from the object model, allowing any kind of parser to be used to construct expressions. Simple Expression Evaluator works by converting an Abstract Syntax Tree into an Expression Tree and evaluating the expression tree. A discussion of dynamic expression evaluation and links to resources can be found here. It is very simple to add new language elements, operators or functions, and comes with an array of options for plugging in custom variable evaluators or function evaluators by either implementing an interface or by associating events with delegates. 

Simple Expression Evaluator’s default parser and expression language use the Irony.net Compiler toolkit. The expression language itself is a modified, stripped down version of Script.NET (S#) and supports things like array indexers and aggregate functions such as Sum, Avg, etc that can be used on collections. Here is a screen shot of the sample app:

Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • DZone
  • Digg
  • Google Bookmarks
  • Ma.gnolia
  • Technorati
hello
Categories
Tools
Comments rss
Comments rss
Trackback
Trackback

« Simple State Machine updated with new Persistence Service Data Structures and Algorithms E-Book (Or, the fast track to limitless power and wealth) »

discussion by DISQUS

Add New Comment

  • Subscribe:  This Thread
  • Go to:  My Comments ·  Community Page
  • Sort thread by:

    Viewing 3 Comments

    Thanks. Your comment is awaiting approval by a moderator.

    Do you already have an account? Log in and claim this comment.

      • ^
      • v
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Ayende Rahien 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Doest it have a purpose?
      Because I would solve this issue with BooParser.ParseString()
      reply  edit  reblog  flag
      http://www.ayende.com/Blog/ /people/730a9f9186e14b8da5a4e453aca2adfe/
      • ^
      • v
      • Parent
      • Permalink
      • Admin
        • Remove Post
        • Block username
        • Block email
        • Block IP address
      nstults 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Ahh Mr. Rahien, I do love how you sugarcoat everything you say. One day you'll walk into a blog and say just what you mean and shock everyone out of their boots.

      I wasn't actually aware of BooParser.ParseString until just this moment. It looks to me, though, like the method gives you an AST tree, which you could then optionally compile and run. This is fine, but I'd still either need to compile the AST tree to my own object model or do a good bit of mucking around with the Boo AST to make sure custom variables were expanded properly, custom functions, etc. I am not sure it would have been any less work at the end of the day, and probably a bit more opaque.

      That being said, I'm *not* sure Simple Expression Evaluator has a strong value proposition when compared to the two already existing Expression Evaluators on CodePlex, FLEE (uses dynamic code generation) and LazyParser (uses reflection). Both probably would work as well as mine, and existed before I wrote this. But I wanted a good excuse to try out Irony.net, and I selfishly wanted full control of the API. And, of course, I like this crap, and enjoy the tinkering (something I'm sure you could never understand :) ) Whether or not it provides anybody with a new and better expression eval library (probably not) it can serve as a pretty textbook example of one common approach to turning an AST into an object model and evaluating it.
      reply  edit  reblog  flag
      1 /people/nstults/ /people/nstults/following/ http://www.thefreakparade.com
      • ^
      • v
      • Parent
      • Permalink
      • Admin
        • Remove Post
        • Block email
        • Block IP address
      Ayende Rahien 4 months ago 1 point

      Please login to rate.

      Do you already have an account? Log in and claim this comment.

      Great reason to write it, mind you.
      I wanted to know that you are aware of the other options.
      reply  edit  reblog  flag
      http://www.ayende.com/Blog/ /people/730a9f9186e14b8da5a4e453aca2adfe/
     
    discussion by DISQUS

    Add New Comment

    Trackbacks

    (Trackback URL)

    close ()

    status via twitter

    recent comments (follow comments)

      View Profile »
      Powered by Disqus · Learn more
      close Reblog this comment
      Powered by Disqus · Learn more
      blog comments powered by Disqus

      Subscribe

      Calendar

      August 2008
      M T W T F S S
      « Jul   Sep »
       123
      45678910
      11121314151617
      18192021222324
      25262728293031

      Recent Posts

      • You Can’t Fill an Imaginary Hole
      • I don’t know but I’ve been told, ETL is gettin’ mighty old. BAM! BAM! EDA! I want my data right away!
      • Be Prepared To Be Surprised
      • Google Chrome, I could kiss you! (Or, multi-process browsers are a really good idea)
      • New Open Source .NET CMS/EPS Platform Released Today: Sense/Net 6.0 Beta 1

      Recent Comments

      • Ashwani on Rule Based Access Control using an Expression Evaluator
      • Richers Blog on Identity’s new Identity - Part 3, The Technology
      • sandra on ESB’s for the Microsoft (.NET) Platform
      • nstults on Content Management Systems (CMS) for the .NET Platform
      • Adz on Content Management Systems (CMS) for the .NET Platform

      Tags

      TDD Testing

      Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org
      rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox