avatar
math expression# Java - 爪哇娇娃
w*r
1
需要用一个简单的math expression parser。类似于做:
f(x1, x2,... xn) = (a1x1 + x2 *x3)*a2 -x4 ..
基本上都是四则运算。有没有什么open source的上手就可以用的library?谢谢!
avatar
m*t
2

antlr? It's fairly straightfoward.

【在 w*r 的大作中提到】
: 需要用一个简单的math expression parser。类似于做:
: f(x1, x2,... xn) = (a1x1 + x2 *x3)*a2 -x4 ..
: 基本上都是四则运算。有没有什么open source的上手就可以用的library?谢谢!

avatar
F*n
3
Why not use Rhino, hoho.

【在 m******t 的大作中提到】
:
: antlr? It's fairly straightfoward.

avatar
c*t
4
No need to use antlr. My CookCC is smaller, faster and better :)
In fact, operator precedence is the worst nightmare for LL parsers
such as antlr.
CookCC even comes with a calculator example (well, a mini script
interpreter of a few hundred lines) that you just need to do minor
modifcations:
http://code.google.com/p/cookcc/source/browse/trunk/tests/javaap/calc/Calculator.java

【在 m******t 的大作中提到】
:
: antlr? It's fairly straightfoward.

avatar
w*r
5
thanks!
永远向唐僧大师学习!

【在 c*****t 的大作中提到】
: No need to use antlr. My CookCC is smaller, faster and better :)
: In fact, operator precedence is the worst nightmare for LL parsers
: such as antlr.
: CookCC even comes with a calculator example (well, a mini script
: interpreter of a few hundred lines) that you just need to do minor
: modifcations:
: http://code.google.com/p/cookcc/source/browse/trunk/tests/javaap/calc/Calculator.java

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。