Expression Parser


#1

Is there an expression parser in the code base, something that will parse basic option payoffs, simple algebra and max, min, and ternary operator if-then-else. I am not so interested in evaluating the expression itself, I am more interested in having access to an expression tree and being able to visit each node in the tree, so that the expression might reduced or transformed.

I see a file Expr.tokens in the OG-Financial project, which suggests there is something?


#2

We have a couple of places that use a generalised expression language, including one for market data manipulations, one for filtering and possibly elsewhere.

We started out with our own expression language specified in an ANTLR grammer, but we’ve since switched to using the standard Java EL (javax.el.*) parsers. If you look in com.opengamma.financial.expression.ELExpressionParser, you should get the idea. Not sure if you can get access to the AST that way though.

We don’t currently have a parser for basic option payoffs though, although it’s something we’ve been considering adding for a while.


#3

I would suggest taking a look at Thetaris. They have a ThetaML language to describe very complex payoffs.

http://www.thetaris.com/

If you would like more info, I will be glad to provide some contacts

OpenGamma | joan@opengamma.com | Tel: +44 20 3416 3314