0

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

kvhdude
  • 1
  • 1
  • 1

1 Answers1

0

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

AFAIK ANTLR is new and powerful than JFLEX.

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
  • ANTLR involves same bootstrapping a grammar like javacc, right? I guess i am asking is there any baked in option in tools like MVEL, JEXEL that can be called during parser? Thanks. – kvhdude Dec 14 '13 at 05:09
  • I don't know about MVEL,JEXEL.You can try some examples on JFLEX and ANTLR – Chandrayya G K Dec 16 '13 at 04:52