Left recursion in Parsing Expression Grammars
Autor(a) principal: | |
---|---|
Data de Publicação: | 2014 |
Outros Autores: | , |
Tipo de documento: | Artigo |
Idioma: | eng |
Título da fonte: | Repositório Institucional da UFRN |
Texto Completo: | https://repositorio.ufrn.br/handle/123456789/30876 |
Resumo: | Parsing Expression Grammars (PEGs) are a formalism that can describe all deterministic context-free languages through a set of rules that specify a top-down parser for some language. PEGs are easy to use, and there are efficient implementations of PEG libraries in several programming languages. A frequently missed feature of PEGs is left recursion, which is commonly used in Context-Free Grammars (CFGs) to encode left-associative operations. We present a simple conservative extension to the semantics of PEGs that gives useful meaning to direct and indirect left-recursive rules, and show that our extensions make it easy to express left-recursive idioms from CFGs in PEGs, with similar results. We prove the conservativeness of these extensions, and also prove that they work with any left-recursive PEG. PEGs can also be compiled to programs in a low-level parsing machine. We present an extension to the semantics of the operations of this parsing machine that let it interpret left-recursive PEGs, and prove that this extension is correct with regard to our semantics for left-recursive PEGs |
id |
UFRN_0924b1ec2f6f8616e29cef0c32d47b1c |
---|---|
oai_identifier_str |
oai:https://repositorio.ufrn.br:123456789/30876 |
network_acronym_str |
UFRN |
network_name_str |
Repositório Institucional da UFRN |
repository_id_str |
|
spelling |
Medeiros, Sérgio Queiroz deMascarenhas, FabioIerusalimschy, Roberto2020-12-07T20:12:46Z2020-12-07T20:12:46Z2014-12-15MEDEIROS, Sérgio; MASCARENHAS, Fabio; IERUSALIMSCHY, Roberto. Left recursion in Parsing Expression Grammars. Science Of Computer Programming, [S.L.], v. 96, p. 177-190, dez. 2014. Disponível em: https://www.sciencedirect.com/science/article/pii/S0167642314000288?via%3Dihub. Acesso em: 06 out. 2020. http://dx.doi.org/10.1016/j.scico.2014.01.013.0167-6423https://repositorio.ufrn.br/handle/123456789/3087610.1016/j.scico.2014.01.013ElsevierAttribution 3.0 Brazilhttp://creativecommons.org/licenses/by/3.0/br/info:eu-repo/semantics/openAccessParsing Expression GrammarsParsingLeft recursionParsing machinePackrat parsingLeft recursion in Parsing Expression Grammarsinfo:eu-repo/semantics/publishedVersioninfo:eu-repo/semantics/articleParsing Expression Grammars (PEGs) are a formalism that can describe all deterministic context-free languages through a set of rules that specify a top-down parser for some language. PEGs are easy to use, and there are efficient implementations of PEG libraries in several programming languages. A frequently missed feature of PEGs is left recursion, which is commonly used in Context-Free Grammars (CFGs) to encode left-associative operations. We present a simple conservative extension to the semantics of PEGs that gives useful meaning to direct and indirect left-recursive rules, and show that our extensions make it easy to express left-recursive idioms from CFGs in PEGs, with similar results. We prove the conservativeness of these extensions, and also prove that they work with any left-recursive PEG. PEGs can also be compiled to programs in a low-level parsing machine. We present an extension to the semantics of the operations of this parsing machine that let it interpret left-recursive PEGs, and prove that this extension is correct with regard to our semantics for left-recursive PEGsengreponame:Repositório Institucional da UFRNinstname:Universidade Federal do Rio Grande do Norte (UFRN)instacron:UFRNCC-LICENSElicense_rdflicense_rdfapplication/rdf+xml; charset=utf-8914https://repositorio.ufrn.br/bitstream/123456789/30876/2/license_rdf4d2950bda3d176f570a9f8b328dfbbefMD52LICENSElicense.txtlicense.txttext/plain; charset=utf-81484https://repositorio.ufrn.br/bitstream/123456789/30876/3/license.txte9597aa2854d128fd968be5edc8a28d9MD53ORIGINALLeftRecursion_MEDEIROS_2014.pdfLeftRecursion_MEDEIROS_2014.pdfapplication/pdf304338https://repositorio.ufrn.br/bitstream/123456789/30876/1/LeftRecursion_MEDEIROS_2014.pdff998597687b3bca28d6d3eee123197a2MD51TEXTLeftRecursion_MEDEIROS_2014.pdf.txtLeftRecursion_MEDEIROS_2014.pdf.txtExtracted texttext/plain69629https://repositorio.ufrn.br/bitstream/123456789/30876/4/LeftRecursion_MEDEIROS_2014.pdf.txt40d8c0d53ebd4206f24cf9586cadaf61MD54THUMBNAILLeftRecursion_MEDEIROS_2014.pdf.jpgLeftRecursion_MEDEIROS_2014.pdf.jpgGenerated Thumbnailimage/jpeg1746https://repositorio.ufrn.br/bitstream/123456789/30876/5/LeftRecursion_MEDEIROS_2014.pdf.jpge1f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federal do Rio Grande do Norte (UFRN)false |
dc.title.pt_BR.fl_str_mv |
Left recursion in Parsing Expression Grammars |
title |
Left recursion in Parsing Expression Grammars |
spellingShingle |
Left recursion in Parsing Expression Grammars Medeiros, Sérgio Queiroz de Parsing Expression Grammars Parsing Left recursion Parsing machine Packrat parsing |
title_short |
Left recursion in Parsing Expression Grammars |
title_full |
Left recursion in Parsing Expression Grammars |
title_fullStr |
Left recursion in Parsing Expression Grammars |
title_full_unstemmed |
Left recursion in Parsing Expression Grammars |
title_sort |
Left recursion in Parsing Expression Grammars |
author |
Medeiros, Sérgio Queiroz de |
author_facet |
Medeiros, Sérgio Queiroz de Mascarenhas, Fabio Ierusalimschy, Roberto |
author_role |
author |
author2 |
Mascarenhas, Fabio Ierusalimschy, Roberto |
author2_role |
author author |
dc.contributor.author.fl_str_mv |
Medeiros, Sérgio Queiroz de Mascarenhas, Fabio Ierusalimschy, Roberto |
dc.subject.por.fl_str_mv |
Parsing Expression Grammars Parsing Left recursion Parsing machine Packrat parsing |
topic |
Parsing Expression Grammars Parsing Left recursion Parsing machine Packrat parsing |
description |
Parsing Expression Grammars (PEGs) are a formalism that can describe all deterministic context-free languages through a set of rules that specify a top-down parser for some language. PEGs are easy to use, and there are efficient implementations of PEG libraries in several programming languages. A frequently missed feature of PEGs is left recursion, which is commonly used in Context-Free Grammars (CFGs) to encode left-associative operations. We present a simple conservative extension to the semantics of PEGs that gives useful meaning to direct and indirect left-recursive rules, and show that our extensions make it easy to express left-recursive idioms from CFGs in PEGs, with similar results. We prove the conservativeness of these extensions, and also prove that they work with any left-recursive PEG. PEGs can also be compiled to programs in a low-level parsing machine. We present an extension to the semantics of the operations of this parsing machine that let it interpret left-recursive PEGs, and prove that this extension is correct with regard to our semantics for left-recursive PEGs |
publishDate |
2014 |
dc.date.issued.fl_str_mv |
2014-12-15 |
dc.date.accessioned.fl_str_mv |
2020-12-07T20:12:46Z |
dc.date.available.fl_str_mv |
2020-12-07T20:12:46Z |
dc.type.status.fl_str_mv |
info:eu-repo/semantics/publishedVersion |
dc.type.driver.fl_str_mv |
info:eu-repo/semantics/article |
format |
article |
status_str |
publishedVersion |
dc.identifier.citation.fl_str_mv |
MEDEIROS, Sérgio; MASCARENHAS, Fabio; IERUSALIMSCHY, Roberto. Left recursion in Parsing Expression Grammars. Science Of Computer Programming, [S.L.], v. 96, p. 177-190, dez. 2014. Disponível em: https://www.sciencedirect.com/science/article/pii/S0167642314000288?via%3Dihub. Acesso em: 06 out. 2020. http://dx.doi.org/10.1016/j.scico.2014.01.013. |
dc.identifier.uri.fl_str_mv |
https://repositorio.ufrn.br/handle/123456789/30876 |
dc.identifier.issn.none.fl_str_mv |
0167-6423 |
dc.identifier.doi.none.fl_str_mv |
10.1016/j.scico.2014.01.013 |
identifier_str_mv |
MEDEIROS, Sérgio; MASCARENHAS, Fabio; IERUSALIMSCHY, Roberto. Left recursion in Parsing Expression Grammars. Science Of Computer Programming, [S.L.], v. 96, p. 177-190, dez. 2014. Disponível em: https://www.sciencedirect.com/science/article/pii/S0167642314000288?via%3Dihub. Acesso em: 06 out. 2020. http://dx.doi.org/10.1016/j.scico.2014.01.013. 0167-6423 10.1016/j.scico.2014.01.013 |
url |
https://repositorio.ufrn.br/handle/123456789/30876 |
dc.language.iso.fl_str_mv |
eng |
language |
eng |
dc.rights.driver.fl_str_mv |
Attribution 3.0 Brazil http://creativecommons.org/licenses/by/3.0/br/ info:eu-repo/semantics/openAccess |
rights_invalid_str_mv |
Attribution 3.0 Brazil http://creativecommons.org/licenses/by/3.0/br/ |
eu_rights_str_mv |
openAccess |
dc.publisher.none.fl_str_mv |
Elsevier |
publisher.none.fl_str_mv |
Elsevier |
dc.source.none.fl_str_mv |
reponame:Repositório Institucional da UFRN instname:Universidade Federal do Rio Grande do Norte (UFRN) instacron:UFRN |
instname_str |
Universidade Federal do Rio Grande do Norte (UFRN) |
instacron_str |
UFRN |
institution |
UFRN |
reponame_str |
Repositório Institucional da UFRN |
collection |
Repositório Institucional da UFRN |
bitstream.url.fl_str_mv |
https://repositorio.ufrn.br/bitstream/123456789/30876/2/license_rdf https://repositorio.ufrn.br/bitstream/123456789/30876/3/license.txt https://repositorio.ufrn.br/bitstream/123456789/30876/1/LeftRecursion_MEDEIROS_2014.pdf https://repositorio.ufrn.br/bitstream/123456789/30876/4/LeftRecursion_MEDEIROS_2014.pdf.txt https://repositorio.ufrn.br/bitstream/123456789/30876/5/LeftRecursion_MEDEIROS_2014.pdf.jpg |
bitstream.checksum.fl_str_mv |
4d2950bda3d176f570a9f8b328dfbbef e9597aa2854d128fd968be5edc8a28d9 f998597687b3bca28d6d3eee123197a2 40d8c0d53ebd4206f24cf9586cadaf61 e1f077b45fd8b4b70efee96028679442 |
bitstream.checksumAlgorithm.fl_str_mv |
MD5 MD5 MD5 MD5 MD5 |
repository.name.fl_str_mv |
Repositório Institucional da UFRN - Universidade Federal do Rio Grande do Norte (UFRN) |
repository.mail.fl_str_mv |
|
_version_ |
1797777205611200512 |