arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 1612.03488cs.PL
收藏

ManyDSL:多种语言的主机

ManyDSL: A Host for Many Languages

Piotr Danilewski, Philipp Slusallek

摘要:

领域特定语言变得越来越重要。几乎每个应用程序都涉及多个领域。但是,如何在同一个应用程序中定义、使用和组合多个DSL呢?最常见的方法是沿着域边界将项目拆分为多个部分和文件。然后,每个文件被单独编译。或者,多种语言可以嵌入到灵活的宿主语言中:在相同的语法中提供新的域语义。在本文中,我们遵循较少探索的变形语言的路线。这些语言能够动态地修改自己的语法和语义,从而成为DSL的更灵活的宿主。我们的语言允许动态创建语法,并在需要时切换语言。我们通过一个新的概念,语法指导执行。语言语法包括语义动作,这些动作是在解析期间立即执行的功能代码片段。通过避免额外的中间表示,连接来自不同语言和领域的动作被大大简化。尽管如此,动作仍然可以通过lambda封装和动态分段生成高度专业化的代码。

英文摘要:

Domain-specific languages are becoming increasingly important. Almost every application touches multiple domains. But how to define, use, and combine multiple DSLs within the same application? The most common approach is to split the project along the domain boundaries into multiple pieces and files. Each file is then compiled separately. Alternatively, multiple languages can be embedded in a flexible host language: within the same syntax a new domain semantic is provided. In this paper we follow a less explored route of metamorphic languages. These languages are able to modify their own syntax and semantics on the fly, thus becoming a more flexible host for DSLs. Our language allows for dynamic creation of grammars and switching languages where needed. We achieve this through a novel concept of Syntax-Directed Execution. A language grammar includes semantic actions that are pieces of functional code executed immediately during parsing. By avoiding additional intermediate representation, connecting actions from different languages and domains is greatly simplified. Still, actions can generate highly specialized code though lambda encapsulation and Dynamic Staging.

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

↑