Abstract
Interactive development environments (IDEs) increase programmer productivity, but unfortunately also the burden on language implementors since sophisticated tool support is expected even for small domain-specific languages. Our goal is to alleviate that burden, by generating IDEs from high-level language specifications using the JastAdd meta-compiler system. This puts increased tension on scope recovery in parsers, since at least a partial AST is required by the system to perform static analysis, such as name completion and context sensitive search.
In this paper we present a novel recovery algorithm called bridge parsing, which provides a light-weight recovery mechanism that complements existing parsing recovery techniques. An initial phase recovers nesting structure in source files making them easier to process by existing parsers. This enables batch parser generators with existing grammars to be used in an interactive setting with minor or no modifications.
We have implemented bridge parsing in a generic extensible IDE for JastAdd based compilers. It is independent of parsing technology, which we validate by showing how it improves recovery in a set of typical interactive editing scenarios for three parser generators: ANTLR (LL(variable lookahead) parsers), LPG (LALR(k) parsers), and Beaver (LALR(1) parsers). ANTLR and LPG both contain sophisticated support for error recovery, while Beaver requires manual error productions. Bridge parsing complements these techniques and yields better recovery for all these tools with only minimal changes to existing grammars.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Bridge Parsing Test Suite (2008), http://www.cs.lth.se/home/Emma.Nilsson_Nyman
Avgustinov, P., Ekman, T., Tibble, J.: Modularity First: A Case for Mixing AOP and Attribute Grammars. In: AOSD. ACM Press, New York (2008)
Burke, M.G., Fisher, G.A.: A practical method for LR and LL syntactic error diagnosis and recovery. ACM Trans. Program. Lang. Syst. 9(2), 164–197 (1987)
Charles, P.: A practical method for constructing efficient LALR(K) parsers with automatic error recovery. PhD thesis, New York, NY, USA (1991)
Degano, P., Priami, C.: Comparison of syntactic error handling in LR parsers, New York, NY, USA, vol. 25, pp. 657–679. John Wiley & Sons, Inc., Chichester (1995)
Earley, J.: An efficient context-free parsing algorithm. Commun. ACM 13(2), 94–102 (1970)
Ekman, T., Hedin, G.: The JastAdd Extensible Java Compiler. In: Gabriel, R.P. (ed.) 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA 2007). ACM Press, New York (2007)
Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation, vol. 39, pp. 111–122. ACM, New York (2004)
Graham, S.L., Haley, C.B., Joy, W.N.: Practical LR error recovery. In: SIGPLAN 1979: Proceedings of the 1979 SIGPLAN symposium on Compiler construction, pp. 168–175. ACM, New York (1979)
Huang, S.S., Hormati, A., Bacon, D.F., Rabbah, R.M.: Liquid Metal: Object-Oriented Programming Across the Hardware/Software Boundary. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 76–103. Springer, Heidelberg (2008)
Jianga, T., Wang, L., Zhang, K.: Alignment of trees - an alternative to tree edit. In: Theoretical Computer Science, vol. 143, pp. 137–148. Elsevier Science B.V., Amsterdam (1995)
Klusener, S., Lämmel, R.: Deriving tolerant grammars from a base-line grammar. In: ICSM 2003: Proceedings of the International Conference on Software Maintenance, Washington, DC, USA, p. 179. IEEE Computer Society, Los Alamitos (2003)
Moonen, L.: Generating robust parsers using island grammars. In: Proceedings. Eighth Working Conference on Reverse Engineering, pp. 13–22. IEEE Computer Society Press, Los Alamitos (2001)
Moonen, L.: Lightweight impact analysis using island grammars. In: Proceedings of the 10th IEEE International Workshop of Program Comprehension, pp. 219–228. IEEE Computer Society, Los Alamitos (2002)
Nilsson-Nyman, E., Ekman, T., Hedin, G., Magnusson, E.: Declarative Intraprocedural Flow Analysis of Java Source Code. In: 8th Workshop on Language Description, Tools and Applications. Electronic Notes in Theoretical Computer Science (ENTCS). Elsevier Science, Amsterdam (2008)
Pennello, T.J., DeRemer, F.: A forward move algorithm for LR error recovery. In: POPL 1978: Proceedings of the 5th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pp. 241–254. ACM, New York (1978)
Schäfer, M., Ekman, T., de Moor, O.: Sound and Extensible Renaming for Java. In: Kiczales, G. (ed.) 23rd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2008). ACM Press, New York (2008)
Tomita, M.: An efficient context-free parsing algorithm for natural languages and its applications. PhD thesis, Pittsburgh, PA, USA (1985)
van Deursen, A., Kuipers, T.: Building documentation generators. In: IEEE International Conference on Software Maintenance, pp. 40–49 (August 1999)
Wagner, T.A.: Practical Algorithms for Incremental Software Development Environments. PhD thesis, Berkeley, CA, USA (1998)
Wagner, T.A., Graham, S.L.: Efficient and flexible incremental parsing. ACM Trans. Program. Lang. Syst. 20(5), 980–1013 (1998)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Nilsson-Nyman, E., Ekman, T., Hedin, G. (2009). Practical Scope Recovery Using Bridge Parsing. In: Gašević, D., Lämmel, R., Van Wyk, E. (eds) Software Language Engineering. SLE 2008. Lecture Notes in Computer Science, vol 5452. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-00434-6_7
Download citation
DOI: https://doi.org/10.1007/978-3-642-00434-6_7
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-00433-9
Online ISBN: 978-3-642-00434-6
eBook Packages: Computer ScienceComputer Science (R0)