首页> 外文会议>IEEE International Conference on Software Maintenance and Evolution >A Reflexive and Automated Approach to Syntactic Pattern Matching in Code Transformations
【24h】

A Reflexive and Automated Approach to Syntactic Pattern Matching in Code Transformations

机译:代码转换中的句法模式匹配的反身和自动化方法

获取原文

摘要

Empowering software engineers often requires to let them write code transformations. However existing automated or tool-supported approaches force developers to have a detailed knowledge of the internal representation of the underlying tool. While this knowledge is time consuming to master, the syntax of the language, on the other hand, is already well known to developers and can serve as a strong foundation for pattern matching. Pattern languages with metavariables (that is variables holding abstract syntax subtrees once the pattern has been matched) have been used to help programmers define program transformations at the language syntax level. The question raised is then the engineering cost of metavariable support. Our contribution is to show that, with a GLR parser, such patterns with metavariables can be supported by using a form of runtime reflexivity on the parser internal structures. This approach allows one to directly implement such patterns on any parser generated by a parser generation framework, without asking the pattern writer to learn the AST structure and node types. As a use case for that approach we describe the implementation built on top of the SmaCC (Smalltalk Compiler Compiler) GLR parser generator framework. This approach has been used in production for source code transformations on a large scale. We will express perspectives to adapt this approach to other types of parsing technologies.
机译:赋予软件工程师常常常常要求提供代码转换。然而,现有的自动或工具支持的方法强制开发人员具有详细了解底层工具的内部表示。虽然这种知识是船长耗时,但另一方面,语言的语法已经是开发人员所知,并且可以作为模式匹配的强大基础。使用Metavariables的模式语言(这是匹配模式的抽象语法子树的变量)已被用于帮助程序员在语言语法级别定义程序转换。提出的问题是,那么是难以支撑的工程成本。我们的贡献是表明,通过GLR解析器,可以通过使用解析器内部结构上的运行时反射性形式来支持具有元址的这种模式。该方法允许人们直接在解析器生成框架生成的任何解析器上对这些模式进行直接在任何解析器上实现这些模式,而不要求图案编写器学习AST结构和节点类型。作为该方法的用例,我们描述了基于SMACC(SmallTalk Compiler Compiler)GLR解析器生成器框架之上的实现。这种方法已用于生产大规模的源代码转换。我们将表达观点,以使这种方法适应其他类型的解析技术。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号