Title
From regexes to parsing expression grammars
Abstract
Most scripting languages nowadays use regex pattern-matching libraries. These regex libraries borrow the syntax of regular expressions, but have an informal semantics that is different from the semantics of regular expressions, removing the commutativity of alternation and adding ad-hoc extensions that cannot be expressed by formalisms for efficient recognition of regular languages, such as deterministic finite automata. Parsing expression grammars are a formalism that can describe all deterministic context-free languages and have a simple computational model. In this paper, we present a formalization of regexes via transformation to parsing expression grammars. The proposed transformation easily accommodates several common regex extensions, giving a formal meaning to them. It also provides a clear computational model that helps to estimate the efficiency of regex-based matchers, and a basis for specifying provably correct optimizations for them.
Year
DOI
Venue
2012
10.1016/j.scico.2012.11.006
Science of Computer Programming
Keywords
DocType
Volume
natural semantics,regular expressions,pattern matching,regexes,parsing expression grammars
Journal
93
Issue
ISSN
Citations 
1
0167-6423
7
PageRank 
References 
Authors
0.61
5
3
Name
Order
Citations
PageRank
Sérgio Medeiros1283.31
Fabio Mascarenhas2285.29
Roberto Ierusalimschy346354.25