50 && bar < 60 && !(mo..." /> 50 && bar < 60 && !(mo..." /> 50 && bar < 60 && !(mo..."/>

hooks during parsing of an expression

283 views Asked by At

I have a requirement to parse and evaluate user defined expressions.

The expressions are of the form "foo > 50 && bar < 60 && !(moo > 50))"

During parsing, there is a need to monitor value for foo > 50, bar < 60 and !(moo > 50) and generate events when conditions are met. The event evaluator will call the expression evaluation.

I looked at MVEL and JEXL, but unable to determine how to get hooks during parsing stage.

Other than bootstrapping a grammar with javacc or lex/yacc, any other options?

I am new to compiler/parser world (other than the class at grad school 20 years ago), please do advise if i am completely off track here.

thanks, -kvh

1

There are 1 answers

2
Chandrayya G K On

You can use JFLEX (http://jflex.de/) and/or ANTLR(http://www.antlr.org/) for this.

AFAIK ANTLR is new and powerful than JFLEX.