寻找表达式评估器 [英] Looking for an expression evaluator

查看:139
本文介绍了寻找表达式评估器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找简单条件表达式的求值器。
表达式应包括变量(只读),字符串,数字和一些基本运算符。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆