Return to search

[en] CONVERTING REGEXES TO PEGS / [pt] CONVERSÃO DE REGEXES PARA PARSING EXPRESSION GRAMMARS

[pt] Expressões regulares são um formalismo utilizado para descrever linguagens
regulares e compõem a base de diversas bibliotecas de casamento de padrão.
No entanto, existem determinados padrões úteis que são complexos ou
impossíveis de serem descritos com expressões regulares puras. Devido a
essas limitações, linguagens de script modernas disponibilizam bibliotecas
de casamento de padrões baseadas em regexes, isto é, extensões de expressões
regulares compostas, principalmente, por construções ad-hoc que focam em
problemas específicos. Apesar de serem muito úteis na prática, os regexes
possuem implementações complexas e distantes do formalismo original
de expressões regulares. Parsing Expression Grammars (PEG) são uma
alternativa formal para reconhecer padrões e possuem mais expressividade
que expressões regulares sem necessitar de contruções ad-hoc. O objetivo
deste trabalho é estudar formas de conversão de regexes para PEGs.
Para isso, estudamos as implementações atuais de regexes e mostramos a
conversão de algumas construções para PEGs. Por fim, apresentamos uma
implementação da conversão de regexes para PEGs para a linguagem Lua. / [en] Regular expressions are a formalism used to describe regular languages
and form the basis of several pattern-matching libraries. However, many
interesting patterns either are difficult to describe or cannot be described
by pure regular expressions. Because of these limitations, modern scripting
languages have pattern matching libraries based on regexes, ie, extensions
of regular expressions mainly composed by a set of ad-hoc constructions
that focus on specific problems. Although very useful in practice, these
implementations are complex and distant from the original formalism of
regular expressions. Parsing Expression Grammars (PEG) are a formal
alternative to recognize patterns and it is much more expressive than pure
regular expressions and does not need use ad-hoc constructions. The goal of
this work is to study the convertion of regexes to PEGs. To accomplish this
task, we studied the current implementations of regexes and show how to
convert some constructions to PEGs. Finally, we present an implementation
that convert regexes to PEGs for the Lua language.

Identiferoai:union.ndltd.org:puc-rio.br/oai:MAXWELL.puc-rio.br:16815
Date28 January 2011
CreatorsMARCELO OIKAWA
ContributorsROBERTO IERUSALIMSCHY
PublisherMAXWELL
Source SetsPUC Rio
LanguagePortuguese
Detected LanguagePortuguese
TypeTEXTO

Page generated in 0.0029 seconds