首页> 外文期刊>Science of Computer Programming >Theory and practice of unparsed patterns for metacompilation
【24h】

Theory and practice of unparsed patterns for metacompilation

机译:元解析非解析模式的理论与实践

获取原文
获取原文并翻译 | 示例
           

摘要

Several software development tools support the matching of concrete syntax user-supplied patterns against the application source code, allowing the detection of invalid, risky, inefficient or forbidden constructs. When applied to compilers, this approach is called metacompilation. These patterns are traditionally parsed into tree patterns, i.e., fragments of abstract-syntax trees with metavariables, which are then matched against the abstract-syntax tree corresponding to the parsing of the source code. Parsing the patterns requires extending the grammar of the application programming language with metavariables, which can be difficult, especially in the case of legacy tools. Instead, we propose a novel matching algorithm which is independent of the programming language because the patterns are not parsed and, as such, are called unparsed patterns. It is as efficient as the classic pattern matching while being easier to implement. By giving up the possibility of static checks that parsed patterns usually enable, it can be integrated within any existing utility based on abstract-syntax trees at a low cost. We present an in-depth coverage of the practical and theoretical aspects of this new technique by describing a working minimal patch for the GNU C compiler, together with a small standalone prototype punned Matchbox, and by lying out a complete formalisation, including mathematical proofs of key algorithmic properties, like correctness and equivalence to the classic matching.
机译:几种软件开发工具支持将用户提供的具体语法与应用程序源代码进行匹配,从而可以检测无效,有风险,效率低下或禁止的构造。当应用于编译器时,此方法称为元编译。传统上将这些模式解析为树模式,即具有元变量的抽象语法树的片段,然后将其与对应于源代码解析的抽象语法树进行匹配。解析模式需要使用元变量扩展应用程序编程语言的语法,这可能很困难,尤其是在使用旧版工具的情况下。取而代之的是,我们提出了一种新颖的匹配算法,该算法与编程语言无关,因为未解析模式,因此将其称为未解析模式。它与经典模式匹配一​​样高效,并且易于实现。通过放弃解析模式通常启用的静态检查的可能性,可以将其以低成本集成在基于抽象语法树的任何现有实用程序中。我们通过描述GNU C编译器的最小工作补丁,小型独立原型punted Matchbox以及完整的形式化方法,包括该方法的数学证明,来深入介绍该新技术的实践和理论方面。关键的算法属性,例如经典匹配的正确性和等效性。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号