Acta Informatica

, Volume 55, Issue 7, pp 547–574 | Cite as

Fast deterministic parsers for transition networks

  • Angelo Borsotti
  • Luca BreveglieriEmail author
  • Stefano Crespi Reghizzi
  • Angelo Morzenti
Original Article


Extended BNF grammars (EBNF) allow regular expressions in the right parts of their rules. They are widely used to define languages, and can be represented by recursive Transition Networks (TN) consisting of a set of finite-state machines. We present a novel direct construction of efficient shift-reduce ELR(1) parsers for TNs. We show that such a parser works deterministically if the TN is free from the classical shift-reduce and reduce–reduce conflicts of the LR(1) parsers, and from a new conflict type called convergence conflict. Such a novel condition for determinism is proved correct and is more general than those proposed in the past for EBNF grammars or TNs. Such ELR(1) parsers perform fewer shift moves than the equivalent LR(1) parsers. A simple optimization of the reduction moves is described.


  1. 1.
    Aho, A., Lam, M., Sethi, R., Ullman, J.: Compilers: Principles, Techniques and Tools. Prentice-Hall, Englewoof Cliffs (2006)zbMATHGoogle Scholar
  2. 2.
    Beatty, J.: On the relationship between the LL(1) and LR(1) grammars. JACM 29(4), 1007–1022 (1982)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Borsotti, A., Breveglieri, L., Crespi Reghizzi, S., Morzenti, A.: Complexity of extended vs classic LR parsers. In: Descriptional Complexity of Formal Systems (DCFS), LNCS, vol. 8614, pp. 77–89. Springer (2014)Google Scholar
  4. 4.
    Breveglieri, L., Crespi Reghizzi, S., Morzenti, A.: Shift-reduce parsers for transition networks. In: Language and Automata Theory and Applications (LATA), LNCS, vol. 8370, pp. 222–235. Springer (2014)Google Scholar
  5. 5.
    Celentano, A.: LR parsing technique for extended context-free grammars. Comput. Lang. 6(2), 95–107 (1981)CrossRefGoogle Scholar
  6. 6.
    Chapman, N.: LALR(1,1) parser generation for regular right part grammars. Acta Inform. 21, 29–45 (1984). MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Conway, M.: Design of a separable transition-diagram compiler. Commun. ACM 6(7), 396–408 (1963)CrossRefGoogle Scholar
  8. 8.
    Crespi Reghizzi, S., Breveglieri, L., Morzenti, A.: Formal Languages and Compilation, 2nd edn. Springer, London (2013)CrossRefGoogle Scholar
  9. 9.
    Engelfriet, J.: Iterating iterated substitution. Theor. Comput. Sci. 5(1), 85–100 (1977). MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Gálvez, J.: A note on a proposed LALR parser for extended context-free grammars. Inf. Process. Lett. 50(6), 303–305 (1994). CrossRefzbMATHGoogle Scholar
  11. 11.
    Grune, D., Jacobs, C.: Parsing Techniques: A Practical Guide, 2nd edn. Springer, London (2009)Google Scholar
  12. 12.
    Gruska, J.: On a classification of context-free languages. Kybernetika 3(1), 22–29 (1967).
  13. 13.
    Heilbrunner, S.: On the definition of ELR(k) and ELL(k) grammars. Acta Inform. 11, 169–176 (1979)MathSciNetCrossRefGoogle Scholar
  14. 14.
    Hemerik, K.: Towards a taxonomy for ECFG and RRPG parsing. In: Language and Automata Theory and Applications (LATA), LNCS, vol. 5457, pp. 410–421. Springer (2009). Google Scholar
  15. 15.
    Jensen, K., Wirth, N.: Pascal User Manual and Report. LNCS, vol. 18, 2nd edn. Springer, Berlin (1975). CrossRefzbMATHGoogle Scholar
  16. 16.
    Kannapinn, S.: Reconstructing LR theory to eliminate redundance, with an application to the construction of ELR parsers. Ph.D. thesis, Technical University of Berlin (2001). (in German) Google Scholar
  17. 17.
    Knuth, D.: On the translation of languages from left to right. Inform. Control 8, 607–639 (1965)MathSciNetCrossRefGoogle Scholar
  18. 18.
    Knuth, D.: Top-down syntax analysis. Acta Inform. 1, 79–110 (1971)CrossRefGoogle Scholar
  19. 19.
    LaLonde, W.: Constructing LR parsers for regular right part grammars. Acta Inform. 11, 177–193 (1979). MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Lee, G., Kim, D.: Characterization of extended LR(k) grammars. Inf. Process. Lett. 64(2), 75–82 (1997). MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    Lewi, J., De Vlaminck, K., Huens, J., Huybrechts, M.: A Programming Methodology in Compiler Construction: Part I and II. North-Holland, Amsterdam (1979)zbMATHGoogle Scholar
  22. 22.
    Morimoto, S., Sassa, M.: Yet another generation of LALR parsers for regular right part grammars. Acta Inform. 37, 671–697 (2001)MathSciNetCrossRefGoogle Scholar
  23. 23.
    Rosenkrantz, D., Stearns, R.: Properties of deterministic top-down grammars. Inform. Control 17(3), 226–256 (1970)MathSciNetCrossRefGoogle Scholar
  24. 24.
    Sassa, M., Nakata, I.: A simple realization of LR-parsers for regular right part grammars. Inf. Process. Lett. 24(2), 113–120 (1987). CrossRefzbMATHGoogle Scholar
  25. 25.
    Wirth, N.: Algorithms \(+\) Data Structures \(=\) Programs. Prentice-Hall, Englewood Cliffs (1975)zbMATHGoogle Scholar

Copyright information

© Springer-Verlag GmbH Germany 2017

Authors and Affiliations

  • Angelo Borsotti
    • 1
  • Luca Breveglieri
    • 1
    Email author
  • Stefano Crespi Reghizzi
    • 1
    • 2
  • Angelo Morzenti
    • 1
  1. 1.DEIB - Politecnico di MilanoMilanItaly
  2. 2.CNR-IEIITBolognaItaly

Personalised recommendations