Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Natural and Flexible Error Recovery for Generated Modular Language Environments

Published: 01 December 2012 Publication History

Abstract

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 full set of context-free grammars, which is closed under composition, and hence can parse languages composed from separate grammar modules. To apply this algorithm in an interactive environment, this article introduces a novel error recovery mechanism. Our approach is language independent, and relies on automatic derivation of recovery rules from grammars. By taking layout information into consideration it can efficiently suggest natural recovery suggestions.

References

[1]
Barnard, D. T. and Holt, R. C. 1982. Hierarchic syntax error repair for lr grammars. Int. J. Comput. Inf. Sci. 11, 4, 231--258.
[2]
Bravenboer, M. and Visser, E. 2004. Concrete syntax for objects: Domain-Specific language embedding and assimilation without restrictions. In Proceedings of the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’04). J. M. Vlissides and D. C. Schmidt Eds., ACM Press, New York, 365--383.
[3]
Bravenboer, M., Tanter, E., and Visser, E. 2006. Declarative, formal, and extensible syntax definition for AspectJ. In Proceedings of the 21th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’06). P. L. Tarr and W. R. Cook Eds., ACM Press, New York, 209--228.
[4]
Bravenboer, M., Dolstra, E., and Visser, E. 2007. Preventing injection attacks with syntax embeddings. In Proceedings of the 6th International Conference on Generative Programming and Component Engineering (GPCE’07). C. Consel and J. L. Lawall Eds., ACM Press, New York, 3--12.
[5]
Bravenboer, M., Kalleberg, K. T., Vermaas, R., and Visser, E. 2008. Stratego/XT 0.17. A language and toolset for program transformation. Sci. Comput. Program. 72, 1--2, 52--70.
[6]
Bravenboer, M., Dolstra, E., and Visser, E. 2010. Preventing injection attacks with syntax embeddings. Sci. Comput. Program. 75, 7, 473--495.
[7]
Burke, M. G. and Fisher, G. A. 1987. A practical method for lr and ll syntactic error diagnosis and recovery. ACM Trans. Program. Lang. Syst. 9, 2, 164--197.
[8]
Cerecke, C. 2002. Repairing syntax errors in lr-based parsers. In Proceedings of the Australian Computer Science Conference (ACSC’02). M. J. Oudshoorn Ed., CRPIT Series, vol. 4. Australian Computer Society, 17--22.
[9]
Charles, P. 1991. A practical method for constructing efficient lalr(k) parsers with automatic error recovery. Ph.D. thesis, New York University.
[10]
Charles, P., Fuhrer, R. M., and Sutton Jr., S. M. 2007. IMP: A meta-tooling platform for creating language-specific ides in Eclipse. In Proceedings of the Automated Software Engineering (ASE’07). R. E. K. Stirewalt, A. Egyed, and B. Fischer Eds., ACM Press, New York, 485--488.
[11]
Corchuelo, R., Pérez, J. A., Cortés, A. R., and Toro, M. 2002. Repairing syntax errors in lr parsers. ACM Trans. Program. Lang. Syst. 24, 6, 698--710.
[12]
de Jonge, M. and Visser, E. 2012. Automated evaluation of syntax error recovery. Tech. rep. TUD-SERG-2012-035, Delft University of Technology, Software Engineering Research Group, Delft, The Netherlands.
[13]
de Jonge, M., Nilsson-Nyman, E., Kats, L. C. L., and Visser, E. 2009. Natural and flexible error recovery for generated parsers. In Proceedings of the 2nd International Conference on Software Language Engineering (SLE’09). M. van den Brand, D. Gasevic, and J. Gray Eds., Lecture Notes in Computer Science Series, vol. 5969, Springer, 204--223.
[14]
Degano, P. and Priami, C. 1995. Comparison of syntactic error handling in lr parsers. Softw. Pract. Exper. 25, 6, 657--679.
[15]
Ducasse, S., Nierstrasz, O., Schärli, N., Wuyts, R., and Black, A. 2006. Traits: A mechanism for fine-grained reuse. ACM Trans. Program. Lang. Syst. 28, 2, 331--388.
[16]
Efftinge, S. and Voelter, M. 2006. oAW xText: A framework for textual dsls. In Proceedings of the Workshop on Modeling Symposium at Eclipse Summit.
[17]
Fischer, C. N., Milton, D. R., and Quiring, S. B. 1980. Efficient ll(1) error correction and recovery using only insertions. Acta Inf. 13, 141--154.
[18]
Ford, B. 2002. Packrat parsing: Simple, powerful, lazy, linear time. SIGPLAN Not. 37, 36--47.
[19]
Fowler, M. 2005a. Language workbenches: The killer-app for domain specific languages? http://martinfowler.com/articles/languageWorkbench.html.
[20]
Fowler, M. 2005b. PostIntelliJ. http://martinfowler.com/bliki/PostIntelliJ.html.
[21]
Grimm, R. 2006. Better extensibility through modular syntax. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’06). 38--51.
[22]
Grönniger, H., Krahn, H., Rumpe, B., Schindler, M., and Völkel, S. 2008. Monticore: A framework for the development of textual domain specific languages. In Proceedings of the International Conference on Software Engineering (ICSE’08). 925--926.
[23]
Heering, J., Hendriks, P. R. H., Klint, P., and Rekers, J. 1989. The syntax definition formalism sdf. SIGPLAN Not. 24, 11, 43--75.
[24]
Heidenreich, F., Johannes, J., Karol, S., Seifert, M., and Wende, C. 2009. Derivation and refinement of textual syntax for models. In Proceedings of the European Conference on Model-Driven Architecture-Foundations and Applications (ECMDA-FA’09). 114--129.
[25]
Johnstone, A., Scott, E., and Economopoulos, G. 2004. Generalised parsing: Some costs. In Lecture Notes in Computer Science, vol. 2985, 89--103.
[26]
Jouault, F., Bézivin, J., and Kurtev, I. 2006. TCS: A dsl for the specification of textual concrete syntaxes in model engineering. In Proceedings of the Generative and Component Engineering (GPCE’06). ACM Press, New York, 249--254.
[27]
Kats, L. C. L. and Visser, E. 2010. The Spoofax language workbench: Rules for declarative specification of languages and ides. In Proceedings of the 25th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’10). W. R. Cook, S. Clarke, and M. C. Rinard Eds., ACM Press, New York, 444--463.
[28]
Kats, L. C. L., Bravenboer, M., and Visser, E. 2008. Mixing source and bytecode: A case for compilation by normalization. In Proceedings of the 23rd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’08). G. E. Harris Ed., ACM Press, New York, 91--108.
[29]
Kats, L. C. L., de Jonge, M., Nilsson-Nyman, E., and Visser, E. 2009a. Providing rapid feedback in generated modular language environments. Adding error recovery to scannerless generalized-LR parsing. In Proceedings of the 24th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’09). G. T. Leavens Ed., ACM Press, New York, 445--464.
[30]
Kats, L. C. L., Sloane, A. M., and Visser, E. 2009b. Decorated attribute grammars: Attribute evaluation meets strategic programming. In Proceedings of the 18th International Conference on Compiler Construction (CC’09) held as Part of the Joint European Conferences on Theory and Practice of Software (ETAPS’09). O. de Moor and M. I. Schwartzbach Eds., Lecture Notes in Computer Science Series, vol. 5501, Springer, 142--157.
[31]
Kats, L. C. L., Kalleberg, K. T., and Visser, E. 2010a. Domain-specific languages for composable editor plugins. In Proceedings of the 9th Workshop on Language Descriptions, Tools and Applications (LDTA’09). ENTCS Series, vol. 253, Elsevier.
[32]
Kats, L. C. L., Visser, E., and Wachsmuth, G. 2010b. Pure and declarative syntax definition: Paradise lost and regained. In Proceedings of the 25th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’10). W. R. Cook, S. Clarke, and M. C. Rinard Eds., ACM Press, New York, 918--932.
[33]
Kats, L. C. L., de Jonge, M., Nilsson-Nyman, E., and Visser, E. 2011. The permissive grammars project. http://strategoxt.org/Stratego/PermissiveGrammars.
[34]
Kiczales, G., Lamping, J., Menhdhekar, A., Maeda, C., Lopes, C., Loingtier, J.-M., and Irwin, J. 1997. Aspect-oriented programming. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP’97). M. Akşit and S. Matsuoka Eds., Lecture Notes in Computer Science, vol. 1241, Springer, 220--242.
[35]
Klusener, S. and Lämmel, R. 2003. Deriving tolerant grammars from a base-line grammar. In International Conference on Software Maintenance (ICSM’03). IEEE Computer Society, 179--189.
[36]
Krahn, H., Rumpe, B., and Völkel, S. 2007. Efficient editor generation for compositional dsls in Eclipse. In Proceedings of the 7th OOPSLA Workshop on Domain-Specific Modeling. Tech. rep. TR-38, University of Jyväskylä, 218--228.
[37]
Krahn, H., Rumpe, B., and Völkel, S. 2008. MontiCore: Modular development of textual domain specific languages. In Proceedings of the International Conference on Objects, Model, Components and Patterns Europe (TOOLS EUROPE’08). R. Paige and B. Meyer Eds., Lecture Notes in Business Information Processing, vol. 11, Springer-Verlag, 297--315.
[38]
Kuhn, T. and Thomann, O. 2006. Eclipse corner: Abstract syntax tree. http://eclipse.org/articles /article.php?file=Article-JavaCodeManipulation_AST/index.html.
[39]
Lavie, A. and Tomita, M. 1993. GLR*-An efficient noise skipping parsing algorithm for context free grammars. In Proceedings of the 3rd International Workshop on Parsing Technologies. 123--134.
[40]
Lévy, J.-P. 1971. Automatic correction of syntax errors in programming languages. Ph.D. thesis, Ithaca, NY.
[41]
Mauney, J. and Fischer, C. 1988. Determining the extent of lookahead in syntactic error repair. ACM Trans. Program. Lang. Syst. 10, 3, 456--469.
[42]
McKenzie, B. J., Yeatman, C., and Vere, L. D. 1995. Error repair in shift-reduce parsers. ACM Trans. Program. Lang. Syst. 17, 4, 672--689.
[43]
Moonen, L. 2001. Generating robust parsers using island grammars. In Proceedings of the Working Conference on Reverse Engineering (WCRE’01). IEEE, 13--22.
[44]
Moonen, L. 2002. Lightweight impact analysis using island grammars. In Proceedings of the 10th IEEE International Workshop of Program Comprehension. IEEE Computer Society, 219--228.
[45]
Nilsson-Nyman, E., Ekman, T., and Hedin, G. 2009. Practical scope recovery using bridge parsing. In Proceedings of the International Conference on Software Language Engineering (SLE’08). D. Gasevic, R. Lämmel, and E. V. Wyk Eds., Lecture Notes in Computer Science, vol. 5452, Springer, 95--113.
[46]
Pai, A. and Kieburtz, R. 1980. Global context recovery: A new strategy for syntactic error recovery by table-drive parsers. ACM Trans. Program. Lang. Syst. 2, 1, 18--41.
[47]
Parr, T. and Fisher, K. 2011. Ll(*): The foundation of the antlr parser generator. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’11). 425--436.
[48]
Parr, T. and Quong, R. 1995. ANTLR: A predicated-ll(k) parser generator. Softw. Pract. Exper. 25, 7, 789--810.
[49]
Pennello, T. J. and DeRemer, F. 1978. A forward move algorithm for lr error recovery. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’78). ACM Press, New York, 241--254.
[50]
Rekers, J. and Koorn, W. 1991. Substring parsing for arbitrary context-free grammars. SIGPLAN Not. 26, 5, 59--66.
[51]
Salomon, D. and Cormack, G. 1995. The disambiguation and scannerless parsing of complete character-level grammars for programming languages. Tech. rep. TR 95/06, Department of Computer Science, University of Manitoba, Winnipeg, Canada.
[52]
Salomon, D. J. and Cormack, G. V. 1989. Scannerless nslr(1) parsing of programming languages. SIGPLAN Not. 24, 7, 170--178.
[53]
Saunders, S., Fields, D. K., and Belayev, E. 2006. IntelliJ IDEA in Action. Manning.
[54]
Schmitz, S. 2006. Modular syntax demands verification. Tech. rep. I3S/RR-2006-32-FR, Laboratoire I3S, Université de Nice-Sophia Antipolis, France.
[55]
Schwerdfeger, A. C. and Van Wyk, E. R. 2009. Verifiable composition of deterministic grammars. SIGPLAN Not. 44, 6, 199--210.
[56]
Swierstra, S. D. and Duponcheel, L. 1996. Deterministic, error-correcting combinator parsers. In Proceedings of the 2nd International School of Advanced Functional Programming. J. Launchbury et al., Eds., Lecture Notes in Computer Science, vol. 1129, Springer, 184--207.
[57]
Synytskyy, N., Cordy, J., and Dean, T. 2003. Robust multilingual parsing using island grammars. In Proceedings of the Conference of the Centre for Advanced Studies on Collaborative Research. IBM Press, 266--278.
[58]
Tai, K.-C. 1978. Syntactic error correction in programming languages. IEEE Trans. Softw. Engin. 4, 5, 414--425.
[59]
Tomita, M. 1988. Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems. Vol. 14, Kluwer Academic Publishers.
[60]
Valkering, R. 2007. Syntax error handling in scannerless generalized lr parsers. M.S. thesis, University of Amsterdam.
[61]
van den Brand, M. G. J., de Jong, H., Klint, P., and Olivier, P. 2000. Efficient annotated terms. Softw. Pract. Exper. 30, 3, 259--291.
[62]
van den Brand, M., Scheerder, J., Vinju, J. J., and Visser, E. 2002a. Disambiguation filters for scannerless generalized lr parsers. In Proceedings of the 11th International Conference on Compiler Construction (CC’02) held as Part of the Joint European Conferences on Theory and Practice of Software (ETAPS’02). R. N. Horspool Ed., Lecture Notes in Computer Science, vol. 2304, Springer, 143--158.
[63]
van den Brand, M. G. J., Heering, J., Klint, P., and Olivier, P. A. 2002b. Compiling language definitions: The asf+sdf compiler. ACM Trans. Program. Lang. Syst. 24, 4, 334--368.
[64]
van den Brand, M. G. J., Bruntink, M., Economopoulos, G. R., de Jong, H. A., Klint, P., Kooiker, T., van der Storm, T., and Vinju, J. J. 2007. Using the meta-environment for maintenance and renovation. In Proceedings of the European Conference on Software Maintenance and Reengineering (CSMR’07). IEEE Computer Society, 331--332.
[65]
van Deursen, A. and Kuipers, T. 1999. Building documentation generators. In Proceedings of the IEEE International Conference on Software Maintenance (ICSM’99). IEEE Computer Society, 40.
[66]
Visser, E. 1997a. A case study in optimizing parsing schemata by disambiguation filters. In Proceedings of the International Workshop on Parsing Technology (IWPT’97). 210--224.
[67]
Visser, E. 1997b. Scannerless generalized-lr parsing. Tech. rep. P9707, Programming Research Group, University of Amsterdam.
[68]
Visser, E. 1997c. Syntax definition for language prototyping. Ph.D. thesis, University of Amsterdam.
[69]
Visser, E. 2002. Meta-Programming with concrete object syntax. In Proceedings of the ACM SIGPLAN-SIGSOFT Conference on Generative Programming and Component Engineering (GPCE’02). D. S. Batory, C. Consel, and W. Taha Eds., Lecture Notes in Computer Science, vol. 2487, Springer, 299--315.
[70]
Waddington, D. and Yao, B. 2007. High-Fidelity c/c++ code transformation. Sci. Comput. Program. 68, 2, 64--78.

Cited By

View all
  • (2024)DGBPSO-DBSCAN: An Optimized Clustering Technique Based on Supervised/Unsupervised Text RepresentationIEEE Access10.1109/ACCESS.2024.344051812(110798-110812)Online publication date: 2024
  • (2023)A text-based syntax completion method using LR parsing and its evaluationScience of Computer Programming10.1016/j.scico.2023.102957228:COnline publication date: 5-Jun-2023
  • (2021)A text-based syntax completion method using LR parsingProceedings of the 2021 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3441296.3441395(32-43)Online publication date: 18-Jan-2021
  • Show More Cited By

Index Terms

  1. Natural and Flexible Error Recovery for Generated Modular Language Environments

      Recommendations

      Reviews

      Boumediene Belkhouche

      To support software development, integrated development environments (IDEs) provide many services, including programmer-friendly feedback while a program is being edited. Typically, these IDEs support not only various programming languages, but also an evolving composition of languages. Thus, unlike traditional parsers, the parsers in IDEs are designed for multiple languages and must be responsive while handling error recovery, syntax highlighting, and content completion. The approach proposed in this paper addresses these issues effectively. It integrates automatically maintained recovery rules; heuristics; grammar formalisms, such as island and permissive grammars; and parsing techniques, such as region recovery and bridge parsing. The implementation of such a system is tested in several experiments, and the results demonstrate the quality, performance, and scalability of the system. While the authors intended their studies to be comprehensive, it should be noted that test cases are generated in an ad hoc manner. A comparison with an existing IDE (Eclipse Java development tools (JDT)) shows the practicality of the proposed approach. Computer-aided software engineering (CASE) developers and compiler writers would greatly benefit from this proposal. Even though the contributions to generalized parsing are substantial, the presentation is verbose, lengthy, and without focus. Digressions and repetitive statements distract from the main topic and make reading the paper burdensome. Moreover, unlike expositions that are found in the traditional compiler theory textbooks, the exposition here suffers from a lack of formality. Further research is needed to provide such formality. Online Computing Reviews Service

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Transactions on Programming Languages and Systems
      ACM Transactions on Programming Languages and Systems  Volume 34, Issue 4
      December 2012
      117 pages
      ISSN:0164-0925
      EISSN:1558-4593
      DOI:10.1145/2400676
      Issue’s Table of Contents
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 01 December 2012
      Accepted: 01 October 2012
      Revised: 01 June 2012
      Received: 01 October 2011
      Published in TOPLAS Volume 34, Issue 4

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. Error recovery
      2. generalized parsing

      Qualifiers

      • Research-article
      • Research
      • Refereed

      Funding Sources

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)74
      • Downloads (Last 6 weeks)12
      Reflects downloads up to 15 Oct 2024

      Other Metrics

      Citations

      Cited By

      View all
      • (2024)DGBPSO-DBSCAN: An Optimized Clustering Technique Based on Supervised/Unsupervised Text RepresentationIEEE Access10.1109/ACCESS.2024.344051812(110798-110812)Online publication date: 2024
      • (2023)A text-based syntax completion method using LR parsing and its evaluationScience of Computer Programming10.1016/j.scico.2023.102957228:COnline publication date: 5-Jun-2023
      • (2021)A text-based syntax completion method using LR parsingProceedings of the 2021 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3441296.3441395(32-43)Online publication date: 18-Jan-2021
      • (2020)An approach to generate text-based IDEs for syntax completion based on syntax specificationProceedings of the 2020 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3372884.3373158(38-44)Online publication date: 20-Jan-2020
      • (2020)Automatic syntax error reporting and recovery in parsing expression grammarsScience of Computer Programming10.1016/j.scico.2019.102373187:COnline publication date: 15-Feb-2020
      • (2020)Multi-purpose Syntax Definition with SDF3Software Engineering and Formal Methods10.1007/978-3-030-58768-0_1(1-23)Online publication date: 14-Sep-2020
      • (2018)Towards automatic error recovery in parsing expression grammarsProceedings of the XXII Brazilian Symposium on Programming Languages10.1145/3264637.3264638(3-10)Online publication date: 20-Sep-2018
      • (2018)Syntax error recovery in parsing expression grammarsProceedings of the 33rd Annual ACM Symposium on Applied Computing10.1145/3167132.3167261(1195-1202)Online publication date: 9-Apr-2018
      • (2018)Error recovery in parsing expression grammars through labeled failures and its implementation based on a parsing machineJournal of Visual Languages & Computing10.1016/j.jvlc.2018.10.00349(17-28)Online publication date: Dec-2018
      • (2016)Principled syntactic code completion using placeholdersProceedings of the 2016 ACM SIGPLAN International Conference on Software Language Engineering10.1145/2997364.2997374(163-175)Online publication date: 20-Oct-2016
      • Show More Cited By

      View Options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Get Access

      Login options

      Full Access

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media