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.
- The permissive grammars project. http://strategoxt.org/Stratego/Permissive-Grammars, 2009.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- P. Degano and C. Priami. Comparison of syntactic error handling in LR parsers. Software - Practice and Experience, 25(6):657-679, 1995. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- S. Efftinge et al. openArchitectureWare User Guide. Version 4.3. Available from http://openarchitectureware. org/pub/documentation/, 2008.Google Scholar
- 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 Scholar
Digital Library
- E. Gamma and K. Beck. JUnit: A cook's tour. Java Report, 4(5):27--38, 1999.Google Scholar
- 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 Scholar
Digital Library
- A. Johnstone, E. Scott, and G. Economopoulos. Generalised parsing: Some costs. Lecture Notes in Computer Science, 2985:89--103, 2004.Google Scholar
Cross Ref
- K. T. Kalleberg. JSGLR. http://www.spoofax.org/.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- T. Parr and R. Quong. ANTLR: A predicated-LL(k) parser generator. Software: Practice and Experience, 25(7):789--810, 1995. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- J. Rekers and W. Koorn. Substring parsing for arbitrary context-free grammars. SIGPLAN Not., 26(5):59--66, 1991. Google Scholar
Digital Library
- 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 Scholar
- D. J. Salomon and G. V. Cormack. Scannerless NSLR(1) parsing of programming languages. SIGPLAN Not., 24(7):170--178, 1989. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- M. Tomita. Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems, volume 14. Kluwer Academic Publishers, 1988. Google Scholar
Digital Library
- R. Valkering. Syntax error handling in scannerless generalized LR parsers. Master's thesis, University of Amsterdam, 2007.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, 1997.Google Scholar
- E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, 1997.Google Scholar
- D. Waddington and B. Yao. High-fidelity C/C++ code transformation. Sci. Comput. Program., 68(2):64--78, 2007. Google Scholar
Digital Library
Index Terms
Providing rapid feedback in generated modular language environments: adding error recovery to scannerless generalized-LR parsing
Recommendations
Natural and Flexible Error Recovery for Generated Modular Language Environments
Integrated Development Environments (IDEs) increase programmer productivity, providing rapid, interactive feedback based on the syntax and semantics of a language. Unlike conventional parsing algorithms, scannerless generalized-LR parsing supports the ...
Providing rapid feedback in generated modular language environments: adding error recovery to scannerless generalized-LR parsing
OOPSLA '09Integrated 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 ...
Language Analysis and Tools for Ambiguous Input Streams
Automatically generated lexers and parsers for programming languages have a long history. Although they are well-suited for many languages, many widely-used generators, among them Flex and Bison, fail to handle input stream ambiguities that arise in ...







Comments