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.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.