Advertisement

Shift-Reduce Parsers for Transition Networks

  • Luca Breveglieri
  • Stefano Crespi Reghizzi
  • Angelo Morzenti
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8370)

Abstract

We give a new direct construction of the shift-reduce ELR (1) parsers for recursive Transition Networks (TN), which is suitable for languages specified by Extended BNF grammars (EBNF). Such parsers are characterized by their absence of conflicts, not just the classical shift-reduce and reduce-reduce types, but also a new type named convergence conflict. Such a condition is proved correct and is more general than the past proposed conditions for the shift-reduce parsing of EBNF grammars or TN’s. The corresponding parser is smaller than a classical one, without any extra bookkeeping. A constraint on TN’s is mentioned, which enables top-down deterministic ELL (1) analysis.

Keywords

extended grammar EBNF LR syntax analysis bottom-up parser 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Beatty, J.C.: On the relationship between the LL(1) and LR(1) grammars. JACM 29(4), 1007–1022 (1982)CrossRefzbMATHMathSciNetGoogle Scholar
  2. 2.
    Breveglieri, L., Crespi Reghizzi, S., Morzenti, A.: Parsing methods streamlined. arXiv:1309.7584 [cs.FL], pp. 1–64 (2013)Google Scholar
  3. 3.
    Celentano, A.: LR parsing technique for extended context-free grammars. Comput. Lang. 6(2), 95–107 (1981)CrossRefGoogle Scholar
  4. 4.
    Chapman, N.P.: LALR(1,1) parser generation for regular right part grammars. Acta Inform. 21, 29–45 (1984), http://dx.doi.org/10.1007/BF00289138 CrossRefzbMATHMathSciNetGoogle Scholar
  5. 5.
    Conway, M.E.: Design of a separable transition-diagram compiler. Comm. ACM 6(7), 396–408 (1963)CrossRefzbMATHGoogle Scholar
  6. 6.
    Crespi Reghizzi, S., Breveglieri, L., Morzenti, A.: Formal languages and compilation, 2nd edn. Springer, London (2013)CrossRefzbMATHGoogle Scholar
  7. 7.
    Crespi Reghizzi, S., Psaila, G.: Grammar partitioning and modular deterministic parsing. Comput. Lang. 24(4), 197–227 (1998)CrossRefzbMATHGoogle Scholar
  8. 8.
    Gálvez, J.F.: A note on a proposed LALR parser for extended context-free grammars. Inf. Process. Lett. 50(6), 303–305 (1994), http://dx.doi.org/10.1016/0020-01909400051-4 CrossRefzbMATHGoogle Scholar
  9. 9.
    Heilbrunner, S.: On the definition of ELR(k) and ELL(k) grammars. Acta Inform. 11, 169–176 (1979)CrossRefzbMATHMathSciNetGoogle Scholar
  10. 10.
    Hemerik, K.: Towards a taxonomy for ECFG and RRPG parsing. In: Dediu, A.H., Ionescu, A.M., Martín-Vide, C. (eds.) LATA 2009. LNCS, vol. 5457, pp. 410–421. Springer, Heidelberg (2009), http://dx.doi.org/10.1007/978-3-642-00982-2 CrossRefGoogle Scholar
  11. 11.
    Kannapinn, S.: Reconstructing LR theory to eliminate redundance, with an application to the construction of ELR parsers (in German). Ph.D. thesis, Tech. Univ. Berlin (2001)Google Scholar
  12. 12.
    Knuth, D.E.: On the translation of languages from left to right. Information and Control 8, 607–639 (1965)CrossRefMathSciNetGoogle Scholar
  13. 13.
    Korenjak, A.J.: A practical method for constructing LR(k) processors. Commun. ACM 12(11), 613–623 (1969)CrossRefzbMATHGoogle Scholar
  14. 14.
    LaLonde, W.R.: Constructing LR parsers for regular right part grammars. Acta Inform. 11, 177–193 (1979), http://dx.doi.org/10.1007/BF00264024 CrossRefzbMATHMathSciNetGoogle Scholar
  15. 15.
    Lee, G.O., Kim, D.H.: Characterization of extended LR(k) grammars. Inf. Process. Lett. 64(2), 75–82 (1997), http://dx.doi.org/10.1016/S0020-01909700152-X CrossRefGoogle Scholar
  16. 16.
    Morimoto, S., Sassa, M.: Yet another generation of LALR parsers for regular right part grammars. Acta Inform. 37, 671–697 (2001)CrossRefzbMATHMathSciNetGoogle Scholar
  17. 17.
    Sassa, M., Nakata, I.: A simple realization of LR-parsers for regular right part grammars. Inf. Process. Lett. 24(2), 113–120 (1987), http://dx.doi.org/10.1016/0020-01908790104-9 CrossRefzbMATHMathSciNetGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Luca Breveglieri
    • 1
  • Stefano Crespi Reghizzi
    • 1
  • Angelo Morzenti
    • 1
  1. 1.Dip. di Elettronica, Informazione e Bioingegneria (DEIB)Politecnico di MilanoMilanoItaly

Personalised recommendations