JVM/BSF是否有真正简单/有限的脚本语言? [英] Are there any really simple/limited scripting languages for the JVM/BSF?

查看:93
本文介绍了JVM/BSF是否有真正简单/有限的脚本语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为JVM或

I'm looking for a really simple / limited scripting language for the JVM or the Bean Scripting Framework but can't find any.

我需要以下运算符:

  • +
  • -
  • *
  • /
  • 也许是**(力量)
  • 也许是sqrt

...以及定义Double类型变量以创建

... and the ability to define Double type variables to create expressions like

(A+B)/2

该脚本可能不会调用任何JVM代码(也许是Math类除外,但这是可选的).

The script may not call any JVM code (maybe with the exception of a Math class, but that's optional).

我有什么选择?

我知道我可以自己写这种东西,但是我更喜欢经过测试的,稳定和快速的解决方案. 我以前很尝试过 Groovy ,但是真的很喜欢……但是很难不让我的用户借助JVM可以完全发挥作用.

I know I could just write that kind of thing myself, but I would prefer a tested, stable and fast solution. I tried Groovy before and really like it... but it's hard no to give my users the full power over the JVM with it.

推荐答案

没有一种语言像我需要的那么简单,因此我将使用ANTLR定义自己的语言.到目前为止,我发现的最好的示例是在此答案.

There are no language that are as simple as I need them, so I will define one myself using ANTLR. The best example I found so far is in this answer.

这篇关于JVM/BSF是否有真正简单/有限的脚本语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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