Loop Patterns: Extension of Kleene Star Operator for More Expressive Pattern Matching against Arbitrary Data Structures
Satoshi Egi

TL;DR
This paper introduces loop patterns, an extension of the Kleene star operator, enabling more expressive pattern matching that adapts to repeat counts and applies to complex data structures like trees and graphs.
Contribution
It proposes loop patterns that overcome limitations of existing repeated patterns, allowing dynamic pattern changes and application to arbitrary data structures.
Findings
Formal semantics of loop patterns are provided.
Numerous working examples demonstrate the expressiveness.
Implemented in Egison language for flexible pattern matching.
Abstract
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.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Database Systems and Queries · Algorithms and Data Compression · Logic, programming, and type systems
