Interpreting mathematical expressions in runtime is a rather standard task in different fields of program engineering. There are different approaches to this problem from creating a specific language-in-a-language with its own parser and interpreter just for that task, to using a fully-fledged embedded compiler. This article is dedicated to a middle-ground solution, implemented in the KMath library. KMath uses Kotlin object builders (DSL) and its own abstractions for mathematical operations to provide a syntax to generate AST for mathematical operations. Then the AST is compiled using just-in-time JVM bytecode generation and other means. A similar approach is tested on other Kotlin platforms


翻译:运行时解析数学表达式是程序工程不同领域的一项相当标准的任务。 解决这个问题有不同的方法, 从创建一种特定语言(一种语言)及其自己的解译员和译员, 直至使用完全的嵌入式编译器。 文章专门用在 KMath 库中执行的中层解决方案。 Kamath 使用 Kotlin 对象构建器( DSL) 及其自己的数学操作抽象化器来提供用于数学操作生成 AST 的语法。 然后, AST 将使用 JVM 字元代码生成和其他方式进行编译。 在其他 Kotlin 平台上测试类似的方法 。

0
下载
关闭预览

相关内容

Kotlin 是一种运行于 Java 虚拟机上的静态类型编程语言。
Linux导论,Introduction to Linux,96页ppt
专知会员服务
76+阅读 · 2020年7月26日
Python计算导论,560页pdf,Introduction to Computing Using Python
专知会员服务
70+阅读 · 2020年5月5日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
39+阅读 · 2019年10月9日
计算机 | 国际会议信息5条
Call4Papers
3+阅读 · 2019年7月3日
计算机 | 入门级EI会议ICVRIS 2019诚邀稿件
Call4Papers
10+阅读 · 2019年6月24日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
CCF A类 | 顶级会议RTSS 2019诚邀稿件
Call4Papers
10+阅读 · 2019年4月17日
Github项目推荐 | pikepdf - Python的PDF读写库
AI研习社
9+阅读 · 2019年3月29日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
A Survey on Bayesian Deep Learning
Arxiv
60+阅读 · 2020年7月2日
AutoML: A Survey of the State-of-the-Art
Arxiv
67+阅读 · 2019年8月14日
Arxiv
3+阅读 · 2017年12月18日
Arxiv
5+阅读 · 2017年10月27日
VIP会员
相关资讯
计算机 | 国际会议信息5条
Call4Papers
3+阅读 · 2019年7月3日
计算机 | 入门级EI会议ICVRIS 2019诚邀稿件
Call4Papers
10+阅读 · 2019年6月24日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
CCF A类 | 顶级会议RTSS 2019诚邀稿件
Call4Papers
10+阅读 · 2019年4月17日
Github项目推荐 | pikepdf - Python的PDF读写库
AI研习社
9+阅读 · 2019年3月29日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
Top
微信扫码咨询专知VIP会员