技术报告:匹配引用正则表达式和透镜
Technical Report: Match-reference regular expressions and lenses
摘要:
镜头是一个程序,它一次指定两个数据转换:一个转换将数据从源格式转换为目标格式,第二个转换反转该过程。在过去的十年中,研究人员已经开发出许多不同类型的具有不同特性的透镜。此类语言中的一类在正则语言上操作。换句话说,这些透镜将从一种正则语言提取的字符串转换为从另一种正则语言提取的字符串(然后再转换回来)。在本文中,我们定义了一种更强大的镜头语言,我们称之为匹配参考镜头,它能够在包含重复子串的非常规格式之间进行翻译,这是一种原始的依赖形式。为了定义非正则格式本身,我们开发了一种新的语言,匹配引用正则表达式,这是一种可以将变量绑定到子字符串并重复使用这些子字符串的正则表达式。这些匹配引用正则表达式与传统正则表达式包中常见的"back-references”密切相关,但经过重新设计,以遵守传统程序设计语言的词法范围约定,并与镜头语言基础设施顺利交互。我们定义了匹配引用正则表达式和匹配引用镜头的语义。我们还定义了一种新的自动机,匹配引用正则自动机系统(MRRAS),用于确定字符串成员的语言匹配引用正则表达式。我们用各种例子来说明我们的定义。
英文摘要:
A lens is a single program that specifies two data transformations at once: one transformation converts data from source format to target format and a second transformation inverts the process. Over the past decade, researchers have developed many different kinds of lenses with different properties. One class of such languages operate over regular languages. In other words, these lenses convert strings drawn from one regular language to strings drawn from another regular language (and back again). In this paper, we define a more powerful language of lenses, which we call match-reference lenses, that is capable of translating between non-regular formats that contain repeated substrings, which is a primitive form of dependency. To define the non-regular formats themselves, we develop a new language, match-reference regular expressions, which are regular expressions that can bind variables to substrings and use those substrings repeatedly. These match-reference regular expressions are closely related to the familiar ``back-references" that can be found in traditional regular expression packages, but are redesigned to adhere to conventional programming language lexical scoping conventions and to interact smoothly with lens language infrastructure. We define the semantics of match-reference regular expressions and match-reference lenses. We also define a new kind of automaton, the match-reference regex automaton system (MRRAS), for deciding string membership in the language match-reference regular expressions. We illustrate our definitions with a variety of examples.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。