arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2102.07924cs.SEcs.PL
收藏

在Kotlin中编译数学表达式

Compilation of mathematical expressions in Kotlin

Iaroslav Postovalov

摘要:

在运行时解释数学表达式是科学软件工程中的标准任务。有不同的方法来解决这个问题,从创建一个嵌入式领域特定语言(eDSL),它有自己的解析器和解释器,专门用于该任务,到使用一个成熟的嵌入式编译器。本文致力于在KMath库中实现的中间解决方案,该库使用Kotlin对象构建器DSL及其自己的代数抽象来生成用于数学运算的AST。然后,这个AST被即时编译以生成JVM字节码。在其他Kotlin平台上测试了类似的方法,在各种支持的平台上比较了其性能。

英文摘要:

Interpreting mathematical expressions at runtime is a standard task in scientific software engineering. There are different approaches to this problem from creating an embedded domain-specific language (eDSL) with its own parser and interpreter specifically for that task, to using a full-fledged embedded compiler. This article is dedicated to a middle-ground solution implemented in the KMath library, which uses the Kotlin object builder DSL and its own algebraic abstractions to generate an AST for mathematical operations. This AST is then compiled just-in-time to generate JVM bytecode. A similar approach is tested on other Kotlin platforms, where its performance is compared across a variety of supported platforms.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑