Acta Informatica

, Volume 51, Issue 7, pp 419–447 | Cite as

On the incremental growth and shrinkage of LR goto-graphs

Original Article

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.

References

  1. 1.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison Wesley, Reading, Massachusetts (1986)Google Scholar
  2. 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 LanguagesGoogle Scholar
  3. 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)Google Scholar
  4. 4.
    Bentley, J.: Programming pearls: little languages. Commun. ACM 29(8), 711–721 (1986)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Bermudez, M.E., Logothetis, G.: Simple computation of LALR(1) lookahead sets. Inf. Process. Lett. 31(5), 233–238 (1989)CrossRefMATHGoogle Scholar
  6. 6.
    Brabrand, C., Schwartzbach, M.I.: The metafront system: safe and extensible parsing and transformation. Sci. Comput. Program. 68, 2–20 (2007)MathSciNetCrossRefMATHGoogle Scholar
  7. 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)Google Scholar
  8. 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)Google Scholar
  9. 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)Google Scholar
  10. 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)Google Scholar
  11. 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)Google Scholar
  12. 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)Google Scholar
  13. 13.
    Cleenewerck, T.: Modularizing Language Constructs: A Reflective Approach. PhD thesis, Vrije Universiteit Brussel, Brussel, Belgium (2007)Google Scholar
  14. 14.
    DeRemer, F., Pennello, T.J.: Efficient computation of LALR(1) look-ahead sets. ACM Trans. Program. Lang. Syst. 4(4), 615–649 (1982)CrossRefMATHGoogle Scholar
  15. 15.
    Earley, J.: An efficient context-free parsing algorithm. Commun. ACM 13(2), 94–102 (1970)CrossRefMATHGoogle Scholar
  16. 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)Google Scholar
  17. 17.
    Ghosh, D.: DSL for the uninitiated. Commun. ACM 54(7), 44–50 (2011)Google Scholar
  18. 18.
    Grimm, R.: Practical Packrat Parsing. Technical Report TR2004-854, New York University, New York, NY, USA (2004)Google Scholar
  19. 19.
    Grune, D., Jacobs, C.J.H.: Parsing techniques. In: Monographs in Computer Science, 2nd edn. Springer (2008)Google Scholar
  20. 20.
    Heering, J., Klint, P., Rekers, J.: Incremental generation of parsers. IEEE Trans. Softw. Eng. 16(12), 1344–1351 (1990)MathSciNetCrossRefGoogle Scholar
  21. 21.
    Horspool, R.N.: Incremental generation of LR parsers. J. Comput. Lang. 15(4), 205–223 (1990)CrossRefGoogle Scholar
  22. 22.
    Hutton, G.: High-order functions for parsing. J. Funct. Program. 2(3), 323–343 (1992)MathSciNetCrossRefMATHGoogle Scholar
  23. 23.
    Knuth, D.E.: On the translation of languages from left to right. Inf. Control 8(6), 607–639 (1965)MathSciNetCrossRefGoogle Scholar
  24. 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)Google Scholar
  25. 25.
    Mens, T., Wermelinger, M.: Separation of concerns for software evolution. J. Maint. Evolut. 14(5), 311–315 (2002)CrossRefGoogle Scholar
  26. 26.
    Moors, A., Piessens, F., Odersky, M.: Parser Combinators in Scala. CW Report 491, Katholieke Universiteit Leuven, Leuven, Belgium (2008)Google Scholar
  27. 27.
    Onzon, E.: dypgen User’s Manual . Available at http://dypgen.free.fr/dypgen-doc.pdf (2012)
  28. 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)Google Scholar
  29. 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)Google Scholar
  30. 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)Google Scholar
  31. 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)Google Scholar
  32. 32.
    Tomita, M.: Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, Berlin (1985)Google Scholar
  33. 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)Google Scholar
  34. 34.
    Ward, M.P.: Language oriented programming. Softw. Concept Tools 15(4), 147–161 (1994)Google Scholar
  35. 35.
    Warth, A.: Experimenting with Programming Languages. PhD thesis, University of California at Los Angeles, Los Angeles, CA, USA (2009)Google Scholar
  36. 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)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  1. 1.Università degli Studi di MilanoMilanItaly

Personalised recommendations