Skip to main content
Log in

On the incremental growth and shrinkage of LR goto-graphs

  • Original Article
  • Published:
Acta Informatica Aims and scope Submit manuscript

Abstract

The LR(0) goto-graph is the basis for the construction of parsers for several interesting grammar classes such as LALR and GLR. Early work has shown that even when a grammar is an extension to another, the goto-graph of the first is not necessarily a subgraph of the second. Some authors presented algorithms to grow and shrink these graphs incrementally, but the formal proof of the existence of a particular relation between a given goto-graph and a grown or shrunk counterpart seems to be still missing in literature as of today. In this paper we use the recursive projection of paths of limited length to prove the existence of one such relation, when the sets of productions are in a subset relation. We also use this relation to present two algorithms (Grow and Shrink) that transform the goto-graph of a given grammar into the goto-graph of an extension or a restriction to that grammar. We implemented these algorithms in a dynamically updatable LALR parser generator called DEXTER (the Dynamically EXTEnsible Recognizer) that we are now shipping with our current implementation of the Neverlang framework for programming language development.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7

Similar content being viewed by others

Notes

  1. We disregard the case when \(Q\) is empty since it is explicitly excluded by our definition of growing grammar (see Sect. 2).

  2. Therefore \(V_S'\subseteq (E_\mathrm{bdg} \cup E_\mathrm{new})\).

  3. In fact, this is what happens in our prototype DEXTER.

References

  1. Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison Wesley, Reading, Massachusetts (1986)

    Google Scholar 

  2. Aycock, J.: The design and implementation of SPARK, a toolkit for implementing domain-specific languages. J. Comput. Inf. Technol. 10(1), 55–66 (2004). special Issue on Domain Specific Languages

    Google Scholar 

  3. Aycock, J., Horspool, R.N.: Directly-executable Earley parsing. In: Wilhelm, R., (ed.) Proceedings of the 10th International Conference on Compiler Construction (CC’01), LNCS, vol. 2027, pp. 229–243. Springer, Genova, Italy (2001)

  4. Bentley, J.: Programming pearls: little languages. Commun. ACM 29(8), 711–721 (1986)

    Article  MathSciNet  Google Scholar 

  5. Bermudez, M.E., Logothetis, G.: Simple computation of LALR(1) lookahead sets. Inf. Process. Lett. 31(5), 233–238 (1989)

    Article  MATH  Google Scholar 

  6. Brabrand, C., Schwartzbach, M.I.: The metafront system: safe and extensible parsing and transformation. Sci. Comput. Program. 68, 2–20 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  7. Bravenboer, M., Visser, E.: Parse table composition: separate compilation and binary extensibility of grammars. In: Software Language Engineering, LNCS, vol. 5452, pp. 74–94. Springer (2009)

  8. Cardelli, L., Matthes, F., Abadi, M.: Extensible Syntax with Lexical Scoping. Technical Report SRC-RR-121, DEC Systems Research Center, Palo Alto, CA, USA (1994)

  9. Cazzola, W.: Domain-Specific Languages in Few Steps: The Neverlang Approach. In: Gschwind, T,, De Paoli, F., Gruhn, V., Book, M. (eds.) Proceedings of the 11th International Conference on Software Composition (SC’12), Lecture Notes in Computer Science, vol. 7306, pp. 162–177. Springer, Prague, Czech Republic (2012)

  10. Cazzola, W., Speziale, I.: Sectional domain specific languages. In: Proceedings of the 4th Domain Specific Aspect-Oriented Languages (DSAL’09), pp. 11–14. ACM, Charlottesville, Virginia, USA (2009)

  11. Cazzola, W., Vacchi, E.: DEXTER and Neverlang: a union towards dynamicity. In: Jul, E., Rogers, I., Zendra, O. (eds.) Proceedings of the 7th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS’12). ACM, Beijing, China (2012)

  12. Cazzola, W., Vacchi, E.: Neverlang 2: componentised language development for the JVM. In: Binder, W., Bodden, E., Löwe, W. (eds.) Proceedings of the 12th International Conference on Software Composition (SC’13), Lecture Notes in Computer Science, vol. 8088, pp. 17–32. Springer, Budapest, Hungary (2013)

  13. Cleenewerck, T.: Modularizing Language Constructs: A Reflective Approach. PhD thesis, Vrije Universiteit Brussel, Brussel, Belgium (2007)

  14. DeRemer, F., Pennello, T.J.: Efficient computation of LALR(1) look-ahead sets. ACM Trans. Program. Lang. Syst. 4(4), 615–649 (1982)

    Article  MATH  Google Scholar 

  15. Earley, J.: An efficient context-free parsing algorithm. Commun. ACM 13(2), 94–102 (1970)

    Article  MATH  Google Scholar 

  16. Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Jones, N.D., Leroy, X. (eds.) Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’04), pp. 111–122. ACM, Venice, Italy (2004)

  17. Ghosh, D.: DSL for the uninitiated. Commun. ACM 54(7), 44–50 (2011)

  18. Grimm, R.: Practical Packrat Parsing. Technical Report TR2004-854, New York University, New York, NY, USA (2004)

  19. Grune, D., Jacobs, C.J.H.: Parsing techniques. In: Monographs in Computer Science, 2nd edn. Springer (2008)

  20. Heering, J., Klint, P., Rekers, J.: Incremental generation of parsers. IEEE Trans. Softw. Eng. 16(12), 1344–1351 (1990)

    Article  MathSciNet  Google Scholar 

  21. Horspool, R.N.: Incremental generation of LR parsers. J. Comput. Lang. 15(4), 205–223 (1990)

    Article  Google Scholar 

  22. Hutton, G.: High-order functions for parsing. J. Funct. Program. 2(3), 323–343 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  23. Knuth, D.E.: On the translation of languages from left to right. Inf. Control 8(6), 607–639 (1965)

    Article  MathSciNet  Google Scholar 

  24. Lehman, M.M., Fernández-Ramil, J.C., Kahen, G.: A Paradigm for the Behavioural Modelling of Software Processes using System Dynamics. Technical Report 2001/8, Imperial College, Department of Computing, London, United Kingdom (2001)

  25. Mens, T., Wermelinger, M.: Separation of concerns for software evolution. J. Maint. Evolut. 14(5), 311–315 (2002)

    Article  Google Scholar 

  26. Moors, A., Piessens, F., Odersky, M.: Parser Combinators in Scala. CW Report 491, Katholieke Universiteit Leuven, Leuven, Belgium (2008)

  27. Onzon, E.: dypgen User’s Manual . Available at http://dypgen.free.fr/dypgen-doc.pdf (2012)

  28. Parr, T., Fisher, K.: LL(*): the foundation of the ANTLR parser generator. In: Padua, D. (ed.) Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’11), pp. 425–436. ACM, San José, California (2011)

  29. Renggli, L., Ducasse, S., Gîrba, T., Nierstrasz, O.: Practical dynamic grammars for dynamic languages. In: Proceedings of the 4th Workshop on Dynamic Languages and Applications (DYLA’10), Málaga, Spain (2010)

  30. Schwerdfeger, A.C., van Wyk, E.R.: Verifiable parse table composition for deterministic parsing. In: van den Brand, M.G.J., Gasevic, D., Gray, J.G. (eds.) Proceedings of the 2nd International Conference on Software Language Engineering (SLE’09), LNCS, vol. 5969, pp. 184–203. Springer, Dublin, Ireland (2009)

  31. Stansifer, P., Wand, M.: Parsing reflective grammars. In: Brabrand, C., van Wyk, E. (eds.) Proceedings of the 11th Workshop on Language Descriptions, Tools and Applications (LDTA’11), pp. 10:1–10:7. ACM, Saarbrucken, Germany (2011)

  32. Tomita, M.: Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, Berlin (1985)

    Google Scholar 

  33. Vacchi, E., Olivares, D.M., Shaqiri, A., Cazzola, W.: Neverlang 2: a framework for modular language implementation. In: Proceedings of the 13th International Conference on Modularity (Modularity’14), pp. 23–26. ACM, Lugano, Switzerland (2014)

  34. Ward, M.P.: Language oriented programming. Softw. Concept Tools 15(4), 147–161 (1994)

    Google Scholar 

  35. Warth, A.: Experimenting with Programming Languages. PhD thesis, University of California at Los Angeles, Los Angeles, CA, USA (2009)

  36. van Wyk, E., Schwerdfeger, A.: Context-aware scanning for parsing extensible languages. In: Consel, C., Lawall, J.L. (eds.) Proceedings of the 6th International Conference on Generative Programming and Component Engineering (GPCE’07), pp. 63–72. ACM, Salzburg, Austria (2007)

Download references

Acknowledgments

This work has been partially supported by the MIUR project CINA: Compositionality, Interaction, Negotiation, Autonomicity for the future ICT society.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Walter Cazzola.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Cazzola, W., Vacchi, E. On the incremental growth and shrinkage of LR goto-graphs. Acta Informatica 51, 419–447 (2014). https://doi.org/10.1007/s00236-014-0201-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00236-014-0201-2

Navigation