For the deterministic context-free languages, we compare the space and time complexity of their LR(1 parsers, constructed in two different ways: the classic method by Knuth for BNF grammars, and the recent one by the authors, which directly builds the parser from EBNF grammars represented as transition networks. For the EBNF grammars, the classic Knuth’s method is indirect as it needs to convert them to BNF. We describe two parametric families of formal languages indexed by the number of stars, which exhibit a linear growth of the parser size (number of states) in passing from the classic to our novel direct methods. Experimental measurements of the number of parser states and of the parsing speed for two real languages (Java and JSON) confirm the advantage of the new direct parser model for EBNF grammars.

Complexity of extended vs classic LR parsers

BREVEGLIERI, LUCA ODDONE;CRESPI REGHIZZI, STEFANO;MORZENTI, ANGELO CARLO
2014-01-01

Abstract

For the deterministic context-free languages, we compare the space and time complexity of their LR(1 parsers, constructed in two different ways: the classic method by Knuth for BNF grammars, and the recent one by the authors, which directly builds the parser from EBNF grammars represented as transition networks. For the EBNF grammars, the classic Knuth’s method is indirect as it needs to convert them to BNF. We describe two parametric families of formal languages indexed by the number of stars, which exhibit a linear growth of the parser size (number of states) in passing from the classic to our novel direct methods. Experimental measurements of the number of parser states and of the parsing speed for two real languages (Java and JSON) confirm the advantage of the new direct parser model for EBNF grammars.
2014
Descriptional Complexity of Formal Systems, DCFS 2014, LNCS 8614
9783319097046
extended BNF grammar; EBNF; LR(1); ELR(1); transition network; TN; shift-reduce; bottom-up parser; parsing performance
File in questo prodotto:
File Dimensione Formato  
borsotti1.pdf

Accesso riservato

Descrizione: articolo principale
: Publisher’s version
Dimensione 294.64 kB
Formato Adobe PDF
294.64 kB Adobe PDF   Visualizza/Apri

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11311/815321
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 1
  • ???jsp.display-item.citation.isi??? 1
social impact