循环模式:Kleene星算子的扩展及其在任意数据结构上的模式匹配
Loop Patterns: Extension of Kleene Star Operator for More Expressive Pattern Matching against Arbitrary Data Structures
摘要:
Kleene星运算符是一个重要的模式构造,用于表示重复多次的模式。由于它的简单性和实用性,它被导入到各种模式匹配系统中,而不是正则表达式。例如,Mathematica有一个类似的模式构造,称为重复模式。然而,它们具有以下限制:(i)我们不能根据当前重复计数改变重复的模式,以及(ii)我们不能将它们应用于任意数据结构,例如树和图而不是列表。本文提出的循环模式,克服这些限制。本文提出了许多工作的例子和形式语义的循环模式。本文中的示例是用Egison程序设计语言编写的,该语言具有针对非自由数据类型的可定制的非线性模式匹配功能。
英文摘要:
The Kleene star operator is an important pattern construct for representing a pattern that repeats multiple times. Due to its simplicity and usefulness, it is imported into various pattern-matching systems other than regular expressions. For example, Mathematica has a similar pattern construct called the repeated pattern. However, they have the following limitations: (i) We cannot change the pattern repeated depending on the current repeat count, and (ii) we cannot apply them to arbitrary data structures such as trees and graphs other than lists. This paper proposes the loop patterns that overcome these limitations. This paper presents numerous working examples and formal semantics of the loop patterns. The examples in this paper are coded in the Egison programming language, which features the customizable non-linear pattern-matching facility for non-free data types.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。