Skip to main content

Practical Scope Recovery Using Bridge Parsing

  • Conference paper
Software Language Engineering (SLE 2008)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5452))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Bridge Parsing Test Suite (2008), http://www.cs.lth.se/home/Emma.Nilsson_Nyman

  2. Avgustinov, P., Ekman, T., Tibble, J.: Modularity First: A Case for Mixing AOP and Attribute Grammars. In: AOSD. ACM Press, New York (2008)

    Google Scholar 

  3. 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)

    Article  Google Scholar 

  4. Charles, P.: A practical method for constructing efficient LALR(K) parsers with automatic error recovery. PhD thesis, New York, NY, USA (1991)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. Earley, J.: An efficient context-free parsing algorithm. Commun. ACM 13(2), 94–102 (1970)

    Article  MATH  Google Scholar 

  7. 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)

    Google Scholar 

  8. Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation, vol. 39, pp. 111–122. ACM, New York (2004)

    MATH  Google Scholar 

  9. 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)

    Chapter  Google Scholar 

  10. 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)

    Chapter  Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Chapter  Google Scholar 

  13. 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)

    Chapter  Google Scholar 

  14. 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)

    Chapter  Google Scholar 

  15. 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)

    Google Scholar 

  16. 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)

    Google Scholar 

  17. 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)

    Google Scholar 

  18. Tomita, M.: An efficient context-free parsing algorithm for natural languages and its applications. PhD thesis, Pittsburgh, PA, USA (1985)

    Google Scholar 

  19. van Deursen, A., Kuipers, T.: Building documentation generators. In: IEEE International Conference on Software Maintenance, pp. 40–49 (August 1999)

    Google Scholar 

  20. Wagner, T.A.: Practical Algorithms for Incremental Software Development Environments. PhD thesis, Berkeley, CA, USA (1998)

    Google Scholar 

  21. Wagner, T.A., Graham, S.L.: Efficient and flexible incremental parsing. ACM Trans. Program. Lang. Syst. 20(5), 980–1013 (1998)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics