On the relation between context-free grammars and parsing expression grammars

Detalhes bibliográficos
Autor(a) principal: Medeiros, Sérgio Queiroz de
Data de Publicação: 2014
Outros Autores: Mascarenhas, Fabio, Roberto Ierusalimschy, Natural semantics
Tipo de documento: Artigo
Idioma: eng
Título da fonte: Repositório Institucional da UFRN
Texto Completo: https://repositorio.ufrn.br/handle/123456789/30875
Resumo: Context-Free Grammars (CFGs) and Parsing Expression Grammars (PEGs) have several similarities and a few differences in both their syntax and semantics, but they are usually presented through formalisms that hinder a proper comparison. In this paper we present a new formalism for CFGs that highlights the similarities and differences between them. The new formalism borrows from PEGs the use of parsing expressions and the recognition-based semantics. We show how one way of removing non-determinism from this formalism yields a formalism with the semantics of PEGs. We also prove, based on these new formalisms, how LL(1) grammars define the same language whether interpreted as CFGs or as PEGs, and also show how strong-LL(k), right-linear, and LL-regular grammars have simple language-preserving translations from CFGs to PEGs. Once these classes of CFGs can be automatically translated to equivalent PEGs, we can reuse classic top-down grammars in PEG-based tools
id UFRN_fa3aa9f113293083da3a0aaa88f09482
oai_identifier_str oai:https://repositorio.ufrn.br:123456789/30875
network_acronym_str UFRN
network_name_str Repositório Institucional da UFRN
repository_id_str
spelling Medeiros, Sérgio Queiroz deMascarenhas, FabioRoberto Ierusalimschy, Natural semantics2020-12-07T20:07:42Z2020-12-07T20:07:42Z2014-09-01MASCARENHAS, Fabio; MEDEIROS, Sérgio; IERUSALIMSCHY, Roberto. On the relation between context-free grammars and parsing expression grammars. Science Of Computer Programming, [S.L.], v. 89, p. 235-250, set. 2014. Disponível em: https://www.sciencedirect.com/science/article/pii/S0167642314000276?via%3Dihub. Acesso em: 06 out. 2020. http://dx.doi.org/10.1016/j.scico.2014.01.012.0167-6423https://repositorio.ufrn.br/handle/123456789/3087510.1016/j.scico.2014.01.012ElsevierAttribution 3.0 Brazilhttp://creativecommons.org/licenses/by/3.0/br/info:eu-repo/semantics/openAccessContext-free grammarsParsing expression grammarsLL(1)LL(k)Natural semanticsOn the relation between context-free grammars and parsing expression grammarsinfo:eu-repo/semantics/publishedVersioninfo:eu-repo/semantics/articleContext-Free Grammars (CFGs) and Parsing Expression Grammars (PEGs) have several similarities and a few differences in both their syntax and semantics, but they are usually presented through formalisms that hinder a proper comparison. In this paper we present a new formalism for CFGs that highlights the similarities and differences between them. The new formalism borrows from PEGs the use of parsing expressions and the recognition-based semantics. We show how one way of removing non-determinism from this formalism yields a formalism with the semantics of PEGs. We also prove, based on these new formalisms, how LL(1) grammars define the same language whether interpreted as CFGs or as PEGs, and also show how strong-LL(k), right-linear, and LL-regular grammars have simple language-preserving translations from CFGs to PEGs. Once these classes of CFGs can be automatically translated to equivalent PEGs, we can reuse classic top-down grammars in PEG-based toolsengreponame:Repositório Institucional da UFRNinstname:Universidade Federal do Rio Grande do Norte (UFRN)instacron:UFRNORIGINALOnRelationBetween_MEDEIROS_2014.pdfOnRelationBetween_MEDEIROS_2014.pdfapplication/pdf334477https://repositorio.ufrn.br/bitstream/123456789/30875/1/OnRelationBetween_MEDEIROS_2014.pdf8e5f36faddb11f3d36d711852e6331aaMD51CC-LICENSElicense_rdflicense_rdfapplication/rdf+xml; charset=utf-8914https://repositorio.ufrn.br/bitstream/123456789/30875/2/license_rdf4d2950bda3d176f570a9f8b328dfbbefMD52LICENSElicense.txtlicense.txttext/plain; charset=utf-81484https://repositorio.ufrn.br/bitstream/123456789/30875/3/license.txte9597aa2854d128fd968be5edc8a28d9MD53TEXTOnRelationBetween_MEDEIROS_2014.pdf.txtOnRelationBetween_MEDEIROS_2014.pdf.txtExtracted texttext/plain75999https://repositorio.ufrn.br/bitstream/123456789/30875/4/OnRelationBetween_MEDEIROS_2014.pdf.txtd45654e7e4630d1bf8c0998889dbf509MD54THUMBNAILOnRelationBetween_MEDEIROS_2014.pdf.jpgOnRelationBetween_MEDEIROS_2014.pdf.jpgGenerated Thumbnailimage/jpeg1740https://repositorio.ufrn.br/bitstream/123456789/30875/5/OnRelationBetween_MEDEIROS_2014.pdf.jpgb2fa0b2a2a3bca5501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lciBvZiB0aGUKY29weXJpZ2h0IHRvIGdyYW50IHRoZSBVbml2ZXJzaWRhZGUgRmVkZXJhbCBkbyBSaW8gR3JhbmRlIGRvIE5vcnRlIHRoZSByaWdodHMgcmVxdWlyZWQgYnkgdGhpcyBsaWNlbnNlLCBhbmQgdGhhdCB0aGlzIG1hdGVyaWFsIHdob3NlIHJpZ2h0cyBhcmUgb2YKdGhpcmQgcGFydGllcyBpcyBjbGVhcmx5IGlkZW50aWZpZWQgYW5kIHJlY29nbml6ZWQgaW4gdGhlIHRleHQgb3IKY29udGVudCBvZiB0aGUgZG9jdW1lbnQgZGVsaXZlcmVkLgoKSWYgdGhlIGRvY3VtZW50IHN1Ym1pdHRlZCBpcyBiYXNlZCBvbiBmdW5kZWQgb3Igc3VwcG9ydGVkIHdvcmsKYnkgYW5vdGhlciBpbnN0aXR1dGlvbiBvdGhlciB0aGFuIHRoZSBVbml2ZXJzaWRhZGUgRmVkZXJhbCBkbyBSaW8gR3JhbmRlIGRvIE5vcnRlLCBkZWNsYXJlcyB0aGF0IGl0IGhhcyBmdWxmaWxsZWQgYW55IG9ibGlnYXRpb25zIHJlcXVpcmVkIGJ5IHRoZSByZXNwZWN0aXZlIGFncmVlbWVudCBvciBhZ3JlZW1lbnQuCgpUaGUgVW5pdmVyc2lkYWRlIEZlZGVyYWwgZG8gUmlvIEdyYW5kZSBkbyBOb3J0ZSB3aWxsIGNsZWFybHkgaWRlbnRpZnkgaXRzIG5hbWUgKHMpIGFzIHRoZSBhdXRob3IgKHMpIG9yIGhvbGRlciAocykgb2YgdGhlIGRvY3VtZW50J3MgcmlnaHRzCmRlbGl2ZXJlZCwgYW5kIHdpbGwgbm90IG1ha2UgYW55IGNoYW5nZXMsIG90aGVyIHRoYW4gdGhvc2UgcGVybWl0dGVkIGJ5CnRoaXMgbGljZW5zZQo=Repositório de PublicaçõesPUBhttp://repositorio.ufrn.br/oai/opendoar:2020-12-13T08:01:33Repositório Institucional da UFRN - Universidade Federal do Rio Grande do Norte (UFRN)false
dc.title.pt_BR.fl_str_mv On the relation between context-free grammars and parsing expression grammars
title On the relation between context-free grammars and parsing expression grammars
spellingShingle On the relation between context-free grammars and parsing expression grammars
Medeiros, Sérgio Queiroz de
Context-free grammars
Parsing expression grammars
LL(1)
LL(k)
Natural semantics
title_short On the relation between context-free grammars and parsing expression grammars
title_full On the relation between context-free grammars and parsing expression grammars
title_fullStr On the relation between context-free grammars and parsing expression grammars
title_full_unstemmed On the relation between context-free grammars and parsing expression grammars
title_sort On the relation between context-free grammars and parsing expression grammars
author Medeiros, Sérgio Queiroz de
author_facet Medeiros, Sérgio Queiroz de
Mascarenhas, Fabio
Roberto Ierusalimschy, Natural semantics
author_role author
author2 Mascarenhas, Fabio
Roberto Ierusalimschy, Natural semantics
author2_role author
author
dc.contributor.author.fl_str_mv Medeiros, Sérgio Queiroz de
Mascarenhas, Fabio
Roberto Ierusalimschy, Natural semantics
dc.subject.por.fl_str_mv Context-free grammars
Parsing expression grammars
LL(1)
LL(k)
Natural semantics
topic Context-free grammars
Parsing expression grammars
LL(1)
LL(k)
Natural semantics
description Context-Free Grammars (CFGs) and Parsing Expression Grammars (PEGs) have several similarities and a few differences in both their syntax and semantics, but they are usually presented through formalisms that hinder a proper comparison. In this paper we present a new formalism for CFGs that highlights the similarities and differences between them. The new formalism borrows from PEGs the use of parsing expressions and the recognition-based semantics. We show how one way of removing non-determinism from this formalism yields a formalism with the semantics of PEGs. We also prove, based on these new formalisms, how LL(1) grammars define the same language whether interpreted as CFGs or as PEGs, and also show how strong-LL(k), right-linear, and LL-regular grammars have simple language-preserving translations from CFGs to PEGs. Once these classes of CFGs can be automatically translated to equivalent PEGs, we can reuse classic top-down grammars in PEG-based tools
publishDate 2014
dc.date.issued.fl_str_mv 2014-09-01
dc.date.accessioned.fl_str_mv 2020-12-07T20:07:42Z
dc.date.available.fl_str_mv 2020-12-07T20:07:42Z
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 MASCARENHAS, Fabio; MEDEIROS, Sérgio; IERUSALIMSCHY, Roberto. On the relation between context-free grammars and parsing expression grammars. Science Of Computer Programming, [S.L.], v. 89, p. 235-250, set. 2014. Disponível em: https://www.sciencedirect.com/science/article/pii/S0167642314000276?via%3Dihub. Acesso em: 06 out. 2020. http://dx.doi.org/10.1016/j.scico.2014.01.012.
dc.identifier.uri.fl_str_mv https://repositorio.ufrn.br/handle/123456789/30875
dc.identifier.issn.none.fl_str_mv 0167-6423
dc.identifier.doi.none.fl_str_mv 10.1016/j.scico.2014.01.012
identifier_str_mv MASCARENHAS, Fabio; MEDEIROS, Sérgio; IERUSALIMSCHY, Roberto. On the relation between context-free grammars and parsing expression grammars. Science Of Computer Programming, [S.L.], v. 89, p. 235-250, set. 2014. Disponível em: https://www.sciencedirect.com/science/article/pii/S0167642314000276?via%3Dihub. Acesso em: 06 out. 2020. http://dx.doi.org/10.1016/j.scico.2014.01.012.
0167-6423
10.1016/j.scico.2014.01.012
url https://repositorio.ufrn.br/handle/123456789/30875
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/30875/1/OnRelationBetween_MEDEIROS_2014.pdf
https://repositorio.ufrn.br/bitstream/123456789/30875/2/license_rdf
https://repositorio.ufrn.br/bitstream/123456789/30875/3/license.txt
https://repositorio.ufrn.br/bitstream/123456789/30875/4/OnRelationBetween_MEDEIROS_2014.pdf.txt
https://repositorio.ufrn.br/bitstream/123456789/30875/5/OnRelationBetween_MEDEIROS_2014.pdf.jpg
bitstream.checksum.fl_str_mv 8e5f36faddb11f3d36d711852e6331aa
4d2950bda3d176f570a9f8b328dfbbef
e9597aa2854d128fd968be5edc8a28d9
d45654e7e4630d1bf8c0998889dbf509
b2fa0b2a2a3bca5501657e3ee82561ad
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_ 1814832945339301888