首页 > 最新文献

Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences最新文献

英文 中文
Rewriting a shallow DSL using a GHC compiler extension 使用GHC编译器扩展重写浅DSL
Mark Grebe, David Young, Andy Gill
Embedded Domain Specific Languages are a powerful tool for developing customized languages to fit specific problem domains. Shallow EDSLs allow a programmer to program using many of the features of a host language and its syntax, but sacrifice performance. Deep EDSLs provide better performance and flexibility, through the ability to manipulate the abstract syntax tree of the DSL program, but sacrifice syntactical similarity to the host language. Using Haskino, an EDSL designed for small embedded systems based on the Arduino line of microcontrollers, and a compiler plugin for the Haskell GHC compiler, we show a method for combining the best aspects of shallow and deep EDSLs. The programmer is able to write in the shallow EDSL, and have it automatically transformed into the deep EDSL. This allows the EDSL user to benefit from powerful aspects of the host language, Haskell, while meeting the demanding resource constraints of the small embedded processing environment.
嵌入式领域特定语言是开发定制语言以适应特定问题领域的强大工具。浅层edsl允许程序员使用宿主语言及其语法的许多特性进行编程,但会牺牲性能。通过能够操作DSL程序的抽象语法树,深度edsl提供了更好的性能和灵活性,但牺牲了与宿主语言的语法相似性。使用Haskino(基于Arduino微控制器系列为小型嵌入式系统设计的EDSL)和Haskell GHC编译器的编译器插件,我们展示了一种结合浅EDSL和深EDSL最佳方面的方法。程序员可以用浅EDSL编写,并自动将其转换为深EDSL。这允许EDSL用户从宿主语言Haskell的强大方面获益,同时满足小型嵌入式处理环境的苛刻资源限制。
{"title":"Rewriting a shallow DSL using a GHC compiler extension","authors":"Mark Grebe, David Young, Andy Gill","doi":"10.1145/3136040.3136048","DOIUrl":"https://doi.org/10.1145/3136040.3136048","url":null,"abstract":"Embedded Domain Specific Languages are a powerful tool for developing customized languages to fit specific problem domains. Shallow EDSLs allow a programmer to program using many of the features of a host language and its syntax, but sacrifice performance. Deep EDSLs provide better performance and flexibility, through the ability to manipulate the abstract syntax tree of the DSL program, but sacrifice syntactical similarity to the host language. Using Haskino, an EDSL designed for small embedded systems based on the Arduino line of microcontrollers, and a compiler plugin for the Haskell GHC compiler, we show a method for combining the best aspects of shallow and deep EDSLs. The programmer is able to write in the shallow EDSL, and have it automatically transformed into the deep EDSL. This allows the EDSL user to benefit from powerful aspects of the host language, Haskell, while meeting the demanding resource constraints of the small embedded processing environment.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"35 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115627107","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 2
Rewriting for sound and complete union, intersection and negation types 重写健全完备的并、交、否定类型
David J. Pearce
Implementing the type system of a programming language is a critical task that is often done in an ad-hoc fashion. Whilst this makes it hard to ensure the system is sound, it also makes it difficult to extend as the language evolves. We are interested in describing type systems using declarative rewrite rules from which an implementation can be automatically generated. Whilst not all type systems are easily expressed in this manner, those involving unions, intersections and negations are well-suited for this. In this paper, we consider a relatively complex type system involving unions, intersections and negations developed previously. This system was not developed with rewriting in mind, though clear parallels are immediately apparent from the original presentation. For example, the system presented required types be first converted into a variation on Disjunctive Normal Form. We identify that the original system can, for the most part, be reworked to enable a natural expression using declarative rewrite rules. We present an implementation of our rewrite rules in the Whiley Rewrite Language (WyRL), and report performance results compared with a hand-coded solution.
实现编程语言的类型系统是一项关键的任务,通常以一种特别的方式完成。虽然这使得确保系统的可靠性变得困难,但也使得随着语言的发展而扩展变得困难。我们感兴趣的是使用声明性重写规则来描述类型系统,从这些规则中可以自动生成实现。虽然不是所有的类型系统都很容易以这种方式表示,但那些涉及联合、交叉和否定的类型系统非常适合这种方式。在本文中,我们考虑了一个相对复杂的类型系统,涉及先前开发的并、交和否定。这个系统的发展并没有考虑到改写,尽管从最初的介绍中可以立即看到明显的相似之处。例如,系统提出的要求类型首先转换为析取范式的变体。我们确定,原始系统在很大程度上可以重新设计,以使用声明性重写规则启用自然表达式。我们用while重写语言(WyRL)给出了重写规则的实现,并报告了与手工编码解决方案相比的性能结果。
{"title":"Rewriting for sound and complete union, intersection and negation types","authors":"David J. Pearce","doi":"10.1145/3136040.3136042","DOIUrl":"https://doi.org/10.1145/3136040.3136042","url":null,"abstract":"Implementing the type system of a programming language is a critical task that is often done in an ad-hoc fashion. Whilst this makes it hard to ensure the system is sound, it also makes it difficult to extend as the language evolves. We are interested in describing type systems using declarative rewrite rules from which an implementation can be automatically generated. Whilst not all type systems are easily expressed in this manner, those involving unions, intersections and negations are well-suited for this. In this paper, we consider a relatively complex type system involving unions, intersections and negations developed previously. This system was not developed with rewriting in mind, though clear parallels are immediately apparent from the original presentation. For example, the system presented required types be first converted into a variation on Disjunctive Normal Form. We identify that the original system can, for the most part, be reworked to enable a natural expression using declarative rewrite rules. We present an implementation of our rewrite rules in the Whiley Rewrite Language (WyRL), and report performance results compared with a hand-coded solution.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"91 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126251809","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 6
Reducing calling convention overhead in object-oriented programming on embedded ARM thumb-2 platforms 在嵌入式ARM thumb-2平台上减少面向对象编程中的调用约定开销
Joseph Caldwell, S. Chiba
This paper examines the causes and extent of code size overhead caused by the ARM calling convention in Thumb-2 binaries. We show that binaries generated from C++ source files generally have higher amounts of calling convention overhead, and present a binary file optimizer to eliminate some of that overhead. Calling convention overhead can negatively impact power consumption, flash memory costs, and chip size in embedded or otherwise resource-constrained domains. This is particularly true on platforms using "compressed" instruction sets, such as the 16-bit ARM Thumb and Thumb-2 instruction sets, used in virtually all smartphones and in many other smaller-scale embedded devices. In this paper, we examine the extent of calling convention overhead in practical software, and compare the results of C and C++ programs, and find that C++ programs generally have a higher percentage of calling-convention overhead. Finally, we demonstrate a tool capable of eliminating some of this overhead, particularly in the case of C++ programs, by modifying the calling conventions on a per-procedure basis.
本文研究了Thumb-2二进制文件中ARM调用约定引起的代码大小开销的原因和程度。我们展示了从c++源文件生成的二进制文件通常具有较高的调用约定开销,并提供了一个二进制文件优化器来消除部分开销。在嵌入式或其他资源受限的领域中,调用约定开销会对功耗、闪存成本和芯片尺寸产生负面影响。在使用“压缩”指令集的平台上尤其如此,例如16位ARM Thumb和Thumb-2指令集,这些指令集几乎用于所有智能手机和许多其他小型嵌入式设备。在本文中,我们研究了实际软件中调用约定开销的程度,并比较了C和c++程序的结果,发现c++程序通常具有更高百分比的调用约定开销。最后,我们将演示一种工具,通过在每个过程的基础上修改调用约定,可以消除部分开销,特别是在c++程序的情况下。
{"title":"Reducing calling convention overhead in object-oriented programming on embedded ARM thumb-2 platforms","authors":"Joseph Caldwell, S. Chiba","doi":"10.1145/3136040.3136057","DOIUrl":"https://doi.org/10.1145/3136040.3136057","url":null,"abstract":"This paper examines the causes and extent of code size overhead caused by the ARM calling convention in Thumb-2 binaries. We show that binaries generated from C++ source files generally have higher amounts of calling convention overhead, and present a binary file optimizer to eliminate some of that overhead. Calling convention overhead can negatively impact power consumption, flash memory costs, and chip size in embedded or otherwise resource-constrained domains. This is particularly true on platforms using \"compressed\" instruction sets, such as the 16-bit ARM Thumb and Thumb-2 instruction sets, used in virtually all smartphones and in many other smaller-scale embedded devices. In this paper, we examine the extent of calling convention overhead in practical software, and compare the results of C and C++ programs, and find that C++ programs generally have a higher percentage of calling-convention overhead. Finally, we demonstrate a tool capable of eliminating some of this overhead, particularly in the case of C++ programs, by modifying the calling conventions on a per-procedure basis.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"53 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"130105753","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 4
Automatic generation of virtual learning spaces driven by CaVaDSL: an experience report CaVaDSL驱动的虚拟学习空间自动生成:一份体验报告
R. G. Martini, P. Henriques
Several applications are based on Domain-Specific Languages (DSL). They provide the right terminology to a peculiar problem/subject, because they use a particular domain vocabulary that defines abstract concepts, different from general-purpose languages. Aiming an easy generation of virtual Learning Spaces (LS) for the use of the responsible of institutional archives or museums, we have idealized and developed an external domain-specific language, called CaVa DSL, to describe, in an abstract level, virtual exhibition rooms in the museum curator's viewpoint, giving the curator the possibility to specify the virtual LS upon a domain ontology vocabulary. We also contribute with a set of processors that deal with CaVa DSL and generates virtual Learning Spaces, turning available the navigation over important and real information contained in archival documents to the public through virtual museums. To demonstrate the obtained results, we present a running example along the paper showing the virtual LS generation process.
一些应用程序是基于领域特定语言(DSL)的。它们为特定的问题/主题提供正确的术语,因为它们使用定义抽象概念的特定领域词汇表,这与通用语言不同。为了方便机构档案馆或博物馆负责人使用虚拟学习空间(LS),我们理想化并开发了一种外部领域特定语言,称为CaVa DSL,以博物馆馆长的观点在抽象层次上描述虚拟展览室,使馆长有可能根据领域本体词汇来指定虚拟LS。我们还提供了一组处理CaVa DSL和生成虚拟学习空间的处理器,通过虚拟博物馆向公众提供档案文件中包含的重要和真实信息的导航。为了证明所获得的结果,我们给出了一个运行的例子来展示虚拟LS的生成过程。
{"title":"Automatic generation of virtual learning spaces driven by CaVaDSL: an experience report","authors":"R. G. Martini, P. Henriques","doi":"10.1145/3136040.3136046","DOIUrl":"https://doi.org/10.1145/3136040.3136046","url":null,"abstract":"Several applications are based on Domain-Specific Languages (DSL). They provide the right terminology to a peculiar problem/subject, because they use a particular domain vocabulary that defines abstract concepts, different from general-purpose languages. Aiming an easy generation of virtual Learning Spaces (LS) for the use of the responsible of institutional archives or museums, we have idealized and developed an external domain-specific language, called CaVa DSL, to describe, in an abstract level, virtual exhibition rooms in the museum curator's viewpoint, giving the curator the possibility to specify the virtual LS upon a domain ontology vocabulary. We also contribute with a set of processors that deal with CaVa DSL and generates virtual Learning Spaces, turning available the navigation over important and real information contained in archival documents to the public through virtual museums. To demonstrate the obtained results, we present a running example along the paper showing the virtual LS generation process.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"167 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"132753505","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 3
Towards compositional and generative tensor optimizations 走向合成和生成张量优化
Adilla Susungi, Norman A. Rink, J. Castrillón, I. Huismann, Albert Cohen, C. Tadonki, J. Stiller, J. Fröhlich
Many numerical algorithms are naturally expressed as operations on tensors (i.e. multi-dimensional arrays). Hence, tensor expressions occur in a wide range of application domains, e.g. quantum chemistry and physics; big data analysis and machine learning; and computational fluid dynamics. Each domain, typically, has developed its own strategies for efficiently generating optimized code, supported by tools such as domain-specific languages, compilers, and libraries. However, strategies and tools are rarely portable between domains, and generic solutions typically act as ''black boxes'' that offer little control over code generation and optimization. As a consequence, there are application domains without adequate support for easily generating optimized code, e.g. computational fluid dynamics. In this paper we propose a generic and easily extensible intermediate language for expressing tensor computations and code transformations in a modular and generative fashion. Beyond being an intermediate language, our solution also offers meta-programming capabilities for experts in code optimization. While applications from the domain of computational fluid dynamics serve to illustrate our proposed solution, we believe that our general approach can help unify research in tensor optimizations and make solutions more portable between domains.
许多数值算法自然地被表示为对张量(即多维数组)的操作。因此,张量表达式出现在广泛的应用领域,如量子化学和物理;大数据分析和机器学习;计算流体动力学。通常,每个领域都开发了自己的策略来有效地生成优化的代码,这些代码由特定于领域的语言、编译器和库等工具支持。然而,策略和工具很少在领域之间移植,而通用解决方案通常充当“黑盒”,对代码生成和优化提供很少的控制。因此,有些应用领域没有足够的支持来轻松生成优化代码,例如计算流体动力学。在本文中,我们提出了一种通用的、易于扩展的中间语言,用于以模块化和生成方式表达张量计算和代码转换。除了作为一种中间语言之外,我们的解决方案还为代码优化专家提供了元编程功能。虽然计算流体力学领域的应用有助于说明我们提出的解决方案,但我们相信我们的一般方法可以帮助统一张量优化的研究,并使解决方案在不同领域之间更具可移植性。
{"title":"Towards compositional and generative tensor optimizations","authors":"Adilla Susungi, Norman A. Rink, J. Castrillón, I. Huismann, Albert Cohen, C. Tadonki, J. Stiller, J. Fröhlich","doi":"10.1145/3136040.3136050","DOIUrl":"https://doi.org/10.1145/3136040.3136050","url":null,"abstract":"Many numerical algorithms are naturally expressed as operations on tensors (i.e. multi-dimensional arrays). Hence, tensor expressions occur in a wide range of application domains, e.g. quantum chemistry and physics; big data analysis and machine learning; and computational fluid dynamics. Each domain, typically, has developed its own strategies for efficiently generating optimized code, supported by tools such as domain-specific languages, compilers, and libraries. However, strategies and tools are rarely portable between domains, and generic solutions typically act as ''black boxes'' that offer little control over code generation and optimization. As a consequence, there are application domains without adequate support for easily generating optimized code, e.g. computational fluid dynamics. In this paper we propose a generic and easily extensible intermediate language for expressing tensor computations and code transformations in a modular and generative fashion. Beyond being an intermediate language, our solution also offers meta-programming capabilities for experts in code optimization. While applications from the domain of computational fluid dynamics serve to illustrate our proposed solution, we believe that our general approach can help unify research in tensor optimizations and make solutions more portable between domains.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"296 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115930423","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 11
Quoted staged rewriting: a practical approach to library-defined optimizations 引用阶段重写:库定义优化的实用方法
L. Parreaux, A. Shaikhha, Christoph E. Koch
Staging has proved a successful technique for programmatically removing code abstractions, thereby allowing for faster program execution while retaining a high-level interface for the programmer. Unfortunately, techniques based on staging suffer from a number of problems — ranging from practicalities to fundamental limitations — which have prevented their widespread adoption. We introduce Quoted Staged Rewriting (QSR), an approach that uses type-safe, pattern matching-enabled quasiquotes to define optimizations. The approach is “staged” in two ways: first, rewrite rules can execute arbitrary code during pattern matching and code reconstruction, leveraging the power and flexibility of staging; second, library designers can orchestrate the application of successive rewriting phases (stages). The advantages of using quasiquote-based rewriting are that library designers never have to deal directly with the intermediate representation (IR), and that it allows for non-intrusive optimizations — in contrast with staging, it is not necessary to adapt the entire library and user programs to accommodate optimizations. We show how Squid, a Scala macro-based framework, enables QSR and renders library-defined optimizations more practical than ever before: library designers write domain-specific optimizers that users invoke transparently on delimited portions of their code base. As a motivating example we describe an implementation of stream fusion (a well-known deforestation technique) that is both simpler and more powerful than the state of the art, and can readily be used by Scala programmers with no knowledge of metaprogramming.
Staging已被证明是一种成功的技术,可以通过编程方式移除代码抽象,从而在为程序员保留高级接口的同时加快程序执行速度。不幸的是,基于分期的技术存在许多问题——从实用性到基本限制——这些问题阻碍了它们的广泛采用。我们将介绍带引号的阶段重写(QSR),这是一种使用类型安全的、支持模式匹配的准引号来定义优化的方法。该方法以两种方式“分阶段”:首先,重写规则可以在模式匹配和代码重构期间执行任意代码,利用分阶段的强大功能和灵活性;其次,库设计者可以编排连续重写阶段(阶段)的应用程序。使用基于准引用的重写的优点是库设计人员不必直接处理中间表示(IR),并且它允许非侵入式优化——与分段相比,不需要调整整个库和用户程序来适应优化。我们将展示Squid(一个基于Scala宏的框架)如何支持QSR,并使库定义的优化比以往任何时候都更加实用:库设计人员编写特定于领域的优化器,用户可以在其代码库的分隔部分透明地调用。作为一个鼓舞人心的例子,我们描述了一个流融合(一种众所周知的毁林技术)的实现,它比目前的技术更简单、更强大,并且可以很容易地被没有元编程知识的Scala程序员使用。
{"title":"Quoted staged rewriting: a practical approach to library-defined optimizations","authors":"L. Parreaux, A. Shaikhha, Christoph E. Koch","doi":"10.1145/3136040.3136043","DOIUrl":"https://doi.org/10.1145/3136040.3136043","url":null,"abstract":"Staging has proved a successful technique for programmatically removing code abstractions, thereby allowing for faster program execution while retaining a high-level interface for the programmer. Unfortunately, techniques based on staging suffer from a number of problems — ranging from practicalities to fundamental limitations — which have prevented their widespread adoption. We introduce Quoted Staged Rewriting (QSR), an approach that uses type-safe, pattern matching-enabled quasiquotes to define optimizations. The approach is “staged” in two ways: first, rewrite rules can execute arbitrary code during pattern matching and code reconstruction, leveraging the power and flexibility of staging; second, library designers can orchestrate the application of successive rewriting phases (stages). The advantages of using quasiquote-based rewriting are that library designers never have to deal directly with the intermediate representation (IR), and that it allows for non-intrusive optimizations — in contrast with staging, it is not necessary to adapt the entire library and user programs to accommodate optimizations. We show how Squid, a Scala macro-based framework, enables QSR and renders library-defined optimizations more practical than ever before: library designers write domain-specific optimizers that users invoke transparently on delimited portions of their code base. As a motivating example we describe an implementation of stream fusion (a well-known deforestation technique) that is both simpler and more powerful than the state of the art, and can readily be used by Scala programmers with no knowledge of metaprogramming.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"25 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123643870","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 17
Parser generation by example for legacy pattern languages 遗留模式语言的解析器生成示例
V. Zaytsev
Most modern software languages enjoy relatively free and relaxed concrete syntax, with significant flexibility of formatting of the program/model/sheet text. Yet, in the dark legacy corners of software engineering there are still languages with a strict fixed column-based structure — the compromises of times long gone, attempting to combine some human readability with some ease of machine processing. In this paper, we consider an industrial case study for retirement of a legacy domain-specific language, completed under extreme circumstances: absolute lack of documentation, varying line structure, hierarchical blocks within one file, scalability demands for millions of lines of code, performance demands for manipulating tens of thousands multi-megabyte files, etc. However, the regularity of the language allowed to infer its structure from the available examples, automatically, and produce highly efficient parsers for it.
大多数现代软件语言享有相对自由和宽松的具体语法,具有程序/模型/表格文本格式的显著灵活性。然而,在软件工程的黑暗角落里,仍然有一些语言具有严格的固定的基于列的结构——这是一去不复返的时代的妥协,试图将一些人类的可读性与一些机器处理的便利性结合起来。在本文中,我们考虑了一个遗留领域特定语言的工业案例研究,在极端情况下完成:绝对缺乏文档,变化的行结构,一个文件中的分层块,数百万行代码的可伸缩性需求,操作数万个兆字节文件的性能需求,等等。然而,语言的规则性允许从可用的示例中自动推断其结构,并为其生成高效的解析器。
{"title":"Parser generation by example for legacy pattern languages","authors":"V. Zaytsev","doi":"10.1145/3136040.3136058","DOIUrl":"https://doi.org/10.1145/3136040.3136058","url":null,"abstract":"Most modern software languages enjoy relatively free and relaxed concrete syntax, with significant flexibility of formatting of the program/model/sheet text. Yet, in the dark legacy corners of software engineering there are still languages with a strict fixed column-based structure — the compromises of times long gone, attempting to combine some human readability with some ease of machine processing. In this paper, we consider an industrial case study for retirement of a legacy domain-specific language, completed under extreme circumstances: absolute lack of documentation, varying line structure, hierarchical blocks within one file, scalability demands for millions of lines of code, performance demands for manipulating tens of thousands multi-megabyte files, etc. However, the regularity of the language allowed to infer its structure from the available examples, automatically, and produce highly efficient parsers for it.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"172 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123801955","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 7
Silverchain: a fluent API generator Silverchain:一个流畅的API生成器
Tomoki Nakamaru, Kazuhiro Ichikawa, Tetsuro Yamazaki, S. Chiba
This paper presents a tool named Silverchain, which generates class definitions for a fluent API from the grammar of the API. A fluent API is an API that is used by method chaining and its grammar is a BNF-like set of rules that defines method chains accepted in type checking. Fluent APIs generated by Silverchain provide two styles of APIs: One is for building a chain by concatenating all method calls in series. The other is for building a chain from partial chains by passing child chains to method calls in the parent chain as their arguments. To generate such a fluent API, Silverchain first translates given grammar into a set of deterministic pushdown automata without ϵ-transitions, then encodes these automata into class definitions. Each constructed automata corresponds to a nonterminal in given grammar and recognizes symbol sequences produced from its corresponding nonterminal.
本文介绍了一个名为Silverchain的工具,它可以根据API的语法为一个流畅的API生成类定义。流畅API是一种用于方法链的API,它的语法是一组类似于bnf的规则,用于定义类型检查中接受的方法链。Silverchain生成的Fluent api提供了两种风格的api:一种是通过串联所有方法调用来构建链。另一种是通过将子链传递给父链中的方法调用作为参数,从部分链构建链。为了生成这样一个流畅的API, Silverchain首先将给定的语法转换为一组不需要ϵ-transitions的确定性下推自动机,然后将这些自动机编码到类定义中。每个构造的自动机对应于给定语法中的一个非终结符,并识别由其相应的非终结符产生的符号序列。
{"title":"Silverchain: a fluent API generator","authors":"Tomoki Nakamaru, Kazuhiro Ichikawa, Tetsuro Yamazaki, S. Chiba","doi":"10.1145/3136040.3136041","DOIUrl":"https://doi.org/10.1145/3136040.3136041","url":null,"abstract":"This paper presents a tool named Silverchain, which generates class definitions for a fluent API from the grammar of the API. A fluent API is an API that is used by method chaining and its grammar is a BNF-like set of rules that defines method chains accepted in type checking. Fluent APIs generated by Silverchain provide two styles of APIs: One is for building a chain by concatenating all method calls in series. The other is for building a chain from partial chains by passing child chains to method calls in the parent chain as their arguments. To generate such a fluent API, Silverchain first translates given grammar into a set of deterministic pushdown automata without ϵ-transitions, then encodes these automata into class definitions. Each constructed automata corresponds to a nonterminal in given grammar and recognizes symbol sequences produced from its corresponding nonterminal.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"9 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123954141","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 13
Accurate reification of complete supertype information for dynamic analysis on the JVM 在JVM上进行动态分析的完整超类型信息的精确具体化
Andrea Rosà, Eduardo Rosales, Walter Binder
Reflective supertype information (RSI) is useful for many instrumentation-based dynamic analyses on the Java Virtual Machine (JVM). On the one hand, while such information can be obtained when performing the instrumentation within the same JVM process executing the instrumented program, in-process instrumentation severely limits the code coverage of the analysis. On the other hand, performing the instrumentation in a separate process can achieve full code coverage, but complete RSI is generally not available, often requiring expensive runtime checks in the instrumented program. Providing accurate and complete RSI in the instrumentation process is challenging because of dynamic class loading and classloader namespaces. In this paper, we present a novel technique to accurately reify complete RSI in a separate instrumentation process. We implement our technique in the dynamic analysis framework DiSL and evaluate it on a task profiler, achieving speedups of up to 45% for an analysis with full code coverage.
反射超类型信息(RSI)对于Java虚拟机(JVM)上许多基于仪器的动态分析非常有用。一方面,虽然在执行被检测程序的同一JVM进程内执行插装可以获得这些信息,但进程内插装严重限制了分析的代码覆盖率。另一方面,在单独的进程中执行插装可以实现完整的代码覆盖,但是完整的RSI通常是不可用的,通常需要在插装的程序中进行昂贵的运行时检查。由于动态类加载和类加载器名称空间的关系,在插装过程中提供准确和完整的RSI是一项挑战。在本文中,我们提出了一种新的技术,可以在单独的仪器过程中精确地再现完整的RSI。我们在动态分析框架DiSL中实现了我们的技术,并在任务分析器上对其进行了评估,在完全代码覆盖的分析中实现了高达45%的加速。
{"title":"Accurate reification of complete supertype information for dynamic analysis on the JVM","authors":"Andrea Rosà, Eduardo Rosales, Walter Binder","doi":"10.1145/3136040.3136061","DOIUrl":"https://doi.org/10.1145/3136040.3136061","url":null,"abstract":"Reflective supertype information (RSI) is useful for many instrumentation-based dynamic analyses on the Java Virtual Machine (JVM). On the one hand, while such information can be obtained when performing the instrumentation within the same JVM process executing the instrumented program, in-process instrumentation severely limits the code coverage of the analysis. On the other hand, performing the instrumentation in a separate process can achieve full code coverage, but complete RSI is generally not available, often requiring expensive runtime checks in the instrumented program. Providing accurate and complete RSI in the instrumentation process is challenging because of dynamic class loading and classloader namespaces. In this paper, we present a novel technique to accurately reify complete RSI in a separate instrumentation process. We implement our technique in the dynamic analysis framework DiSL and evaluate it on a task profiler, achieving speedups of up to 45% for an analysis with full code coverage.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"15 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"130531781","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 5
Refining semantics for multi-stage programming 改进多阶段编程的语义
Rui Ge, Ronald Garcia
The multi-stage programming paradigm supports runtime code generation and execution. Though powerful, its potential is impeded by the lack of static analysis support. Van Horn and Might proposed a general-purpose approach to systematically develop static analyses by transforming an environmental abstract machine, which evolves a control string, an environment and a continuation as a program evaluates. To the best of our knowledge, no such semantics exists for a multi-stage language like MetaML. We develop and prove correct an environmental abstract machine semantics for MetaML by gradually refining the reference substitutional structural operational semantics. Highlights of our approach include leveraging explicit substitutions to bridge the gap between substitutional and environmental semantics, and devising meta-environments to model the complexities of variable bindings in multi-stage environmental semantics.
多阶段编程范式支持运行时代码生成和执行。尽管功能强大,但由于缺乏静态分析支持,它的潜力受到了阻碍。Van Horn和Might提出了一种通用方法,通过转换环境抽象机器来系统地开发静态分析,该机器在程序评估时演变为控制字符串,环境和延续。据我们所知,像MetaML这样的多阶段语言不存在这样的语义。我们通过逐步细化引用替代结构操作语义,开发并证明了MetaML的环境抽象机器语义。我们的方法的亮点包括利用显式替代来弥合替代语义和环境语义之间的差距,并设计元环境来模拟多阶段环境语义中变量绑定的复杂性。
{"title":"Refining semantics for multi-stage programming","authors":"Rui Ge, Ronald Garcia","doi":"10.1145/3136040.3136047","DOIUrl":"https://doi.org/10.1145/3136040.3136047","url":null,"abstract":"The multi-stage programming paradigm supports runtime code generation and execution. Though powerful, its potential is impeded by the lack of static analysis support. Van Horn and Might proposed a general-purpose approach to systematically develop static analyses by transforming an environmental abstract machine, which evolves a control string, an environment and a continuation as a program evaluates. To the best of our knowledge, no such semantics exists for a multi-stage language like MetaML. We develop and prove correct an environmental abstract machine semantics for MetaML by gradually refining the reference substitutional structural operational semantics. Highlights of our approach include leveraging explicit substitutions to bridge the gap between substitutional and environmental semantics, and devising meta-environments to model the complexities of variable bindings in multi-stage environmental semantics.","PeriodicalId":398999,"journal":{"name":"Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences","volume":"242 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2017-10-23","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131613677","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 1
期刊
Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
全部 Acc. Chem. Res. ACS Applied Bio Materials ACS Appl. Electron. Mater. ACS Appl. Energy Mater. ACS Appl. Mater. Interfaces ACS Appl. Nano Mater. ACS Appl. Polym. Mater. ACS BIOMATER-SCI ENG ACS Catal. ACS Cent. Sci. ACS Chem. Biol. ACS Chemical Health & Safety ACS Chem. Neurosci. ACS Comb. Sci. ACS Earth Space Chem. ACS Energy Lett. ACS Infect. Dis. ACS Macro Lett. ACS Mater. Lett. ACS Med. Chem. Lett. ACS Nano ACS Omega ACS Photonics ACS Sens. ACS Sustainable Chem. Eng. ACS Synth. Biol. Anal. Chem. BIOCHEMISTRY-US Bioconjugate Chem. BIOMACROMOLECULES Chem. Res. Toxicol. Chem. Rev. Chem. Mater. CRYST GROWTH DES ENERG FUEL Environ. Sci. Technol. Environ. Sci. Technol. Lett. Eur. J. Inorg. Chem. IND ENG CHEM RES Inorg. Chem. J. Agric. Food. Chem. J. Chem. Eng. Data J. Chem. Educ. J. Chem. Inf. Model. J. Chem. Theory Comput. J. Med. Chem. J. Nat. Prod. J PROTEOME RES J. Am. Chem. Soc. LANGMUIR MACROMOLECULES Mol. Pharmaceutics Nano Lett. Org. Lett. ORG PROCESS RES DEV ORGANOMETALLICS J. Org. Chem. J. Phys. Chem. J. Phys. Chem. A J. Phys. Chem. B J. Phys. Chem. C J. Phys. Chem. Lett. Analyst Anal. Methods Biomater. Sci. Catal. Sci. Technol. Chem. Commun. Chem. Soc. Rev. CHEM EDUC RES PRACT CRYSTENGCOMM Dalton Trans. Energy Environ. Sci. ENVIRON SCI-NANO ENVIRON SCI-PROC IMP ENVIRON SCI-WAT RES Faraday Discuss. Food Funct. Green Chem. Inorg. Chem. Front. Integr. Biol. J. Anal. At. Spectrom. J. Mater. Chem. A J. Mater. Chem. B J. Mater. Chem. C Lab Chip Mater. Chem. Front. Mater. Horiz. MEDCHEMCOMM Metallomics Mol. Biosyst. Mol. Syst. Des. Eng. Nanoscale Nanoscale Horiz. Nat. Prod. Rep. New J. Chem. Org. Biomol. Chem. Org. Chem. Front. PHOTOCH PHOTOBIO SCI PCCP Polym. Chem.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1