skip to main content
10.1145/1640089.1640122acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Providing rapid feedback in generated modular language environments: adding error recovery to scannerless generalized-LR parsing

Published:25 October 2009Publication History

ABSTRACT

Integrated development environments (IDEs) increase programmer productivity, providing rapid, interactive feedback based on the syntax and semantics of a language. A heavy burden lies on developers of new languages to provide adequate IDE support. Code generation techniques provide a viable, efficient approach to semi-automatically produce IDE plugins. Key components for the realization of plugins are the language's grammar and parser. For embedded languages and language extensions, constituent IDE plugin modules and their grammars can be combined. Unlike conventional parsing algorithms, scannerless generalized-LR parsing supports the full set of context-free grammars, which is closed under composition, and hence can parse language embeddings and extensions composed from separate grammar modules. To apply this algorithm in an interactive environment, this paper introduces a novel error recovery mechanism, which allows it to be used with files with syntax errors -- common in interactive editing. Error recovery is vital for providing rapid feedback in case of syntax errors, as most IDE services depend on the parser from syntax highlighting to semantic analysis and cross-referencing. We base our approach on the principles of island grammars, and derive permissive grammars with error recovery productions from normal SDF grammars. To cope with the added complexity of these grammars, we adapt the parser to support backtracking. We evaluate the recovery quality and performance of our approach using a set of composed languages, based on Java and Stratego.

References

  1. The permissive grammars project. http://strategoxt.org/Stratego/Permissive-Grammars, 2009.Google ScholarGoogle Scholar
  2. M. G. J. van den Brand, H. de Jong, P. Klint, and P. Olivier. Efficient annotated terms. Software, Practice&Experience, 30(3):259--291, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. G. J. van den Brand, J. Scheerder, J. Vinju, and E. Visser. Disambiguation filters for scannerless generalized LR parsers. In N. Horspool, editor, Compiler Construction (CC 2002), volume 2304 of Lecture Notes in Computer Science, pages 143--158. Springer-Verlag, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Bravenboer, E. Dolstra, and E. Visser. Preventing injection attacks with syntax embeddings. A host and guest language independent approach. In J. Lawall, editor, Generative Programming and Component Engineering (GPCE 2007), pages 3--12. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming, 72(1-2):52--70, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. Bravenboer, E. Tanter, and E. Visser. Declarative, formal, and extensible syntax definition for AspectJ. A case for scannerless generalized-LR parsing. In W. R. Cook, editor, Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2006), pages 209--228. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Bravenboer and E. Visser. Concrete syntax for objects. Domain-specific language embedding and assimilation without restrictions. In D. C. Schmidt, editor, ObjectOriented Programing, Systems, Languages, and Applications (OOPSLA 2004), pages 365--383. ACM, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. P. Charles, R. M. Fuhrer, and S. M. Sutton, Jr. IMP: a meta-tooling platform for creating language-specific IDEs in Eclipse. In R. E. K. Stirewalt, A. Egyed, and B. Fischer, editors, Automated Software Engineering (ASE 2007), pages 485--488. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Charles, R. M. Fuhrer, S. M. Sutton, Jr., E. Duesterwald, and J. Vinju. Accelerating the creation of customized, language-specific IDEs in Eclipse. In G. T. Leavens, editor, Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2009). ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. P. Degano and C. Priami. Comparison of syntactic error handling in LR parsers. Software - Practice and Experience, 25(6):657-679, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. Ducasse, O. Nierstrasz, N. Scharli, R. Wuyts, and A. Black. Traits: A mechanism for fine-grained reuse. Transactions on Programming Languages and Systems (TOPLAS), 28(2):331--388, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. Economopoulos, P. Klint, and J. Vinju. Faster scannerless GLR parsing. In O. de Moor and M. I. Schwartzbach, editors, Compiler Construction (CC'09), pages 126--141. SpringerVerlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Efftinge et al. openArchitectureWare User Guide. Version 4.3. Available from http://openarchitectureware. org/pub/documentation/, 2008.Google ScholarGoogle Scholar
  14. B. Ford. Packrat parsing: Simple, powerful, lazy, linear time. In International Conference on Functional Programming (ICFP'02), volume 37 of SIGPLAN Notices, pages 36--47. ACM, October 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. E. Gamma and K. Beck. JUnit: A cook's tour. Java Report, 4(5):27--38, 1999.Google ScholarGoogle Scholar
  16. T. Jiang, L. Wang, and K. Zhang. Alignment of trees - an alternative to tree edit. In CPM '94: Proceedings of the 5th Annual Symposium on Combinatorial Pattern Matching, volume 807 of LNCS, pages 75--86, London, UK, 1994. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Johnstone, E. Scott, and G. Economopoulos. Generalised parsing: Some costs. Lecture Notes in Computer Science, 2985:89--103, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  18. K. T. Kalleberg. JSGLR. http://www.spoofax.org/.Google ScholarGoogle Scholar
  19. L. C. L. Kats, M. Bravenboer, and E. Visser. Mixing source and bytecode. A case for compilation by normalization. In G. Kiczales, editor, Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2008), pages 91--108. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. L. C. L. Kats, K. T. Kalleberg, and E. Visser. Domainspecific languages for composable editor plugins. In T. Ekman and J. Vinju, editors, Language Descriptions, Tools, and Applications (LDTA 2009), ENTCS. Elsevier Science Publishers, 2009.Google ScholarGoogle Scholar
  21. G. Kiczales, J. Lamping, A. Menhdhekar, C. Maeda, C. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-oriented programming. In M. Aks,it and S. Matsuoka, editors, Proceedings of the European Conference on Object--Oriented Programming (ECOOP'07), volume 1241 of LNCS, pages 220--242. Springer, 1997.Google ScholarGoogle Scholar
  22. S. Klusener and R. Lammel. Deriving tolerant grammars from a base-line grammar. In International Conference on Software Maintenance (ICSM '03), pages 179--189. IEEE Computer Society, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. H. Krahn, B. Rumpe, and S. Voelkel. Efficient editor generation for compositional DSLs in Eclipse. In Proceedings of the 7th OOPSLA Workshop on Domain-Specific Modeling, technical report TR-38, pages 218--228. University of Jyv"askyl"a, 2007.Google ScholarGoogle Scholar
  24. H. Krahn, B. Rumpe, and S. Voelkel. Monticore: Modular development of textual domain specific languages. In R. Paige and B. Meyer, editors, TOOLS EUROPE 2008, volume 11 of Lecture Notes in Business Information Processing, pages 297--315. Springer-Verlag, June 2008.Google ScholarGoogle Scholar
  25. A. Lavie and M. Tomita. GLR*-an efficient noise skipping parsing algorithm for context free grammars. In Third International Workshop on Parsing Technologies, pages 123--134, 1993.Google ScholarGoogle Scholar
  26. L. Moonen. Generating robust parsers using island grammars. In Working Conference on Reverse Engineering (WCRE'01), pages 13--22. IEEE Computer Society Press, Oct 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. L. Moonen. Lightweight impact analysis using island grammars. In Proceedings of the 10th IEEE International Workshop of Program Comprehension, pages 219--228. IEEE Computer Society, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. E. Nilsson--Nyman, T. Ekman, and G. Hedin. Practical scope recovery using bridge parsing. In D. Gasevic, R. L"ammel, and E. V. Wyk, editors, Software Language Engineering (SLE 2008), volume 5452 of LNCS, pages 95--113. Springer, 2008. Google ScholarGoogle Scholar
  29. T. Parr and R. Quong. ANTLR: A predicated-LL(k) parser generator. Software: Practice and Experience, 25(7):789--810, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. T. J. Pennello and F. DeRemer. A forward move algorithm for LR error recovery. In Principles of programming languages (POPL '78), pages 241--254. ACM, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. J. Rekers and W. Koorn. Substring parsing for arbitrary context-free grammars. SIGPLAN Not., 26(5):59--66, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. D. Salomon and G. Cormack. The disambiguation and scannerless parsing of complete character-level grammars for programming languages. Technical report, Technical Report 95/06, Department of Computer Science, University of Manitoba, Winnipeg, Canada, 1995.Google ScholarGoogle Scholar
  33. D. J. Salomon and G. V. Cormack. Scannerless NSLR(1) parsing of programming languages. SIGPLAN Not., 24(7):170--178, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. N. Synytskyy, J. Cordy, and T. Dean. Robust multilingual parsing using island grammars. In Proceedings of the 2003 conference of the Centre for Advanced Studies on Collaborative research, pages 266--278. IBM Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. M. Tomita. Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems, volume 14. Kluwer Academic Publishers, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. R. Valkering. Syntax error handling in scannerless generalized LR parsers. Master's thesis, University of Amsterdam, 2007.Google ScholarGoogle Scholar
  37. M. G. J. van den Brand, M. Bruntink, G. R. Economopoulos, H. A. de Jong, P. Klint, T. Kooiker, T. van der Storm, and J. J. Vinju. Using the Meta-Environment for maintenance and renovation. In The European Conference on Software Maintenance and Reengineering (CSMR'07), pages 331--332. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. M. G. J. van den Brand, J. Heering, P. Klint, and P. A. Olivier. Compiling language definitions: the ASF+SDF compiler. ACM Trans. Program. Lang. Syst., 24(4):334--368, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. A. van Deursen and T. Kuipers. Building documentation generators. In IEEE International Conference on Software Maintenance (ICSM '99), page 40. IEEE Computer Society, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, 1997.Google ScholarGoogle Scholar
  41. E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, 1997.Google ScholarGoogle Scholar
  42. D. Waddington and B. Yao. High-fidelity C/C++ code transformation. Sci. Comput. Program., 68(2):64--78, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Providing rapid feedback in generated modular language environments: adding error recovery to scannerless generalized-LR parsing

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!