Search engine for discovering works of Art, research articles, and books related to Art and Culture
ShareThis
Javascript must be enabled to continue!

A text pattern‐matching tool based on Parsing Expression Grammars

View through CrossRef
AbstractCurrent text pattern‐matching tools are based on regular expressions. However, pure regular expressions have proven too weak a formalism for the task: many interesting patterns either are difficult to describe or cannot be described by regular expressions. Moreover, the inherent non‐determinism of regular expressions does not fit the need to capture specific parts of a match. Motivated by these reasons, most scripting languages nowadays use pattern‐matching tools that extend the original regular‐expression formalism with a set of ad hoc features, such as greedy repetitions, lazy repetitions, possessive repetitions, ‘longest‐match rule,’ lookahead, etc. These ad hoc extensions bring their own set of problems, such as lack of a formal foundation and complex implementations. In this paper, we propose the use of Parsing Expression Grammars (PEGs) as a basis for pattern matching. Following this proposal, we present LPEG, a pattern‐matching tool based on PEGs for the Lua scripting language. LPEG unifies the ease of use of pattern‐matching tools with the full expressive power of PEGs. Because of this expressive power, it can avoid the myriad of ad hoc constructions present in several current pattern‐matching tools. We also present a Parsing Machine that allows a small and efficient implementation of PEGs for pattern matching. Copyright © 2008 John Wiley & Sons, Ltd.
Title: A text pattern‐matching tool based on Parsing Expression Grammars
Description:
AbstractCurrent text pattern‐matching tools are based on regular expressions.
However, pure regular expressions have proven too weak a formalism for the task: many interesting patterns either are difficult to describe or cannot be described by regular expressions.
Moreover, the inherent non‐determinism of regular expressions does not fit the need to capture specific parts of a match.
Motivated by these reasons, most scripting languages nowadays use pattern‐matching tools that extend the original regular‐expression formalism with a set of ad hoc features, such as greedy repetitions, lazy repetitions, possessive repetitions, ‘longest‐match rule,’ lookahead, etc.
These ad hoc extensions bring their own set of problems, such as lack of a formal foundation and complex implementations.
In this paper, we propose the use of Parsing Expression Grammars (PEGs) as a basis for pattern matching.
Following this proposal, we present LPEG, a pattern‐matching tool based on PEGs for the Lua scripting language.
LPEG unifies the ease of use of pattern‐matching tools with the full expressive power of PEGs.
Because of this expressive power, it can avoid the myriad of ad hoc constructions present in several current pattern‐matching tools.
We also present a Parsing Machine that allows a small and efficient implementation of PEGs for pattern matching.
Copyright © 2008 John Wiley & Sons, Ltd.

Related Results

Evolutionary Grammatical Inference
Evolutionary Grammatical Inference
Grammatical Inference (also known as grammar induction) is the problem of learning a grammar for a language from a set of examples. In a broad sense, some data is presented to the ...
Optimising tool wear and workpiece condition monitoring via cyber-physical systems for smart manufacturing
Optimising tool wear and workpiece condition monitoring via cyber-physical systems for smart manufacturing
Smart manufacturing has been developed since the introduction of Industry 4.0. It consists of resource sharing and networking, predictive engineering, and material and data analyti...
Semantic Graphical Dependence Parsing Model in Improving English Teaching Abilities
Semantic Graphical Dependence Parsing Model in Improving English Teaching Abilities
It is a very difficult problem to achieve high-order functionality for graphical dependency parsing without growing decoding difficulties. To solve this problem, this article offer...
E-Press and Oppress
E-Press and Oppress
From elephants to ABBA fans, silicon to hormone, the following discussion uses a new research method to look at printed text, motion pictures and a te...
On Flores Island, do "ape-men" still exist? https://www.sapiens.org/biology/flores-island-ape-men/
On Flores Island, do "ape-men" still exist? https://www.sapiens.org/biology/flores-island-ape-men/
<span style="font-size:11pt"><span style="background:#f9f9f4"><span style="line-height:normal"><span style="font-family:Calibri,sans-serif"><b><spa...
2021 Census to Census Coverage Survey Matching Results.
2021 Census to Census Coverage Survey Matching Results.
The 2021 England and Wales Census was matched to the Census Coverage Survey (CCS). This was an essential requisite for estimating undercount in the Census. To ensure outputs could ...
A Fast Pattern Matching Algorithm Based on Middle Characters of Pattern String
A Fast Pattern Matching Algorithm Based on Middle Characters of Pattern String
String pattern matching is one of the important string operation. At present, the pattern matching algorithm of strings mainly includes BF algorithm, KMP algorithm, and improved KM...
ON A SUPERCLASS OF A-GRAMMARS
ON A SUPERCLASS OF A-GRAMMARS
In this paper we consider a superclass of automaton grammars that can be represented in terms of paths on graphs. With this approach, we assume that vertices of graph are labeled b...

Back to Top