寻找表达式评估器 [英] Looking for an expression evaluator
问题描述
我正在寻找简单条件表达式的求值器。
表达式应包括变量(只读),字符串,数字和一些基本运算符。
I'm looking for an evaluator for simple condition expressions. Expressions should include variables (read only), strings, numbers and some basic operators.
例如。表达式如下:
${a} == "Peter" && ( ${b} == null || ${c} > 10 )
到目前为止我实现了一个相当神奇的解析器,它返回一个我可以评估的AST,但我无法相信我是第一个解决这个问题的人。
So far i implemented a rather "magical" parser that returns an AST that i can evaluate, but i can't believe that i'm the first one to solve that problem.
什么我可以使用现有的代码吗?
What existing code could i use instead?
推荐答案
SPEL(Spring Expression Lang)怎么样; http://static.springsource.org/spring/docs/3.0.x/reference/ expressions.html
What about SPEL (Spring Expression Lang); http://static.springsource.org/spring/docs/3.0.x/reference/expressions.html
这篇关于寻找表达式评估器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!