首页> 外文会议>Proceedings of the 2012 ACM SIGPLAN principles and practice of declarative programming >Functional Semantics of Parsing Actions, and Left Recursion Elimination as Continuation Passing
【24h】

Functional Semantics of Parsing Actions, and Left Recursion Elimination as Continuation Passing

机译:解析动作的功能语义,以及在继续传递时消除左递归

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

摘要

Parsers, whether constructed by hand or automatically via a parser generator tool, typically need to compute some useful semantic information in addition to the purely syntactic analysis of their input. Semantic actions may be added to parsing code by hand, or the parser generator may have its own syntax for annotating grammar rules with semantic actions. In this paper, we take a functional programming view of such actions. We use concepts from the semantics of mostly functional programming languages and adapt them to give meaning to the actions of the parser. Specifically, the semantics is inspired by the categorical semantics of lambda calculi and the use of premonoidal categories for the semantics of effects in programming languages. This framework is then applied to our leading example, the transformation of grammars to eliminate left recursion. The syntactic transformation of left-recursion elimination leads to a corresponding semantic transformation of the actions for the grammar. We prove the semantic transformation correct and relate it to continuation passing style, a widely studied transformation in lambda calculi and functional programming.
机译:解析器,无论是手工构建的还是通过解析器生成器工具自动构建的,除了对其输入进行纯语法分析之外,通常还需要计算一些有用的语义信息。可以手动将语义动作添加到解析代码中,或者解析器生成器可以具有自己的语法,以使用语义动作来注释语法规则。在本文中,我们从功能编程的角度来看待此类行为。我们使用大多数功能性编程语言的语义中的概念,并对其进行修改以赋予解析器操作的含义。具体来说,语义是受λ演算的类别语义以及编程语言中效果的语义使用premonoidal类别启发的。然后将此框架应用于我们的主要示例,即语法转换以消除左递归。左递归消除的句法转换导致语法动作的相应语义转换。我们证明了语义转换的正确性,并将其与延续传递样式,lambda计算和函数编程中经过广泛研究的转换联系起来。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号