Skip to main content

Supporting Compile-Time Debugging and Precise Error Reporting in Meta-programs

  • Conference paper
Book cover Objects, Models, Components, Patterns (TOOLS 2012)

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

Abstract

Compile-time meta-programming is an advanced language feature enabling to mix programs with definitions that are executed at compile-time and may generate source code to be put in their place. Such definitions are called meta-programs and their actual evaluation constitutes a compilation stage. As meta-programs are also programs, programmers should be supported in handling compile-time and runtime errors, something introducing challenges to the entire tool chain along two lines. Firstly, the source point of a compile error may well be the outcome of a series of compilation stages, thus never appearing within the original program. Effectively, the latter requires a compiler to track down the error chain across all involved stages so as to provide a meaningful, descriptive and precise error report. Secondly, every compilation stage is instantiated by the execution of the respective staged program. Thus, typical full-fledged source-level debugging for any particular stage should be facilitated during the compilation process. Existing implementations suffer in both terms, overall providing poor error messages, while lacking the required support to debug meta-programs of any staging depth. In this paper we firstly outline an implementation of a meta-programming system offering all mentioned facilities. Then, we detail the required amendments to the compilation process. Finally, we discuss the necessary interoperation points between the compiler and the tool-chain (IDE).

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. Kernighan, B.W., Ritchie, D.M.: The C programming language. Prentice-Hall, Englewood Cliffs (1988)

    Google Scholar 

  2. Bawden, A.: Quasiquotation in Lisp. In: Danvy, O. (ed.) Proceedings of the Workshop on Partial Evaluation and Semantics-Based Program Manipulation, San Antonio, pp. 88–99. University of Aarhus, Dept. of Computer Science. Invited talk (1999)

    Google Scholar 

  3. Martel, M., Sheard, T.: Introduction to multi-stage programming using MetaML. Technical report, OGI, Portland, OR, 211, 213 (September 1997)

    Google Scholar 

  4. Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Proceedings of the Symposium on Partial Evaluation and Semantic-Based Program Manipulation (PEPM), Amsterdam, pp. 203–217. ACM Press (1997)

    Google Scholar 

  5. Sheard, T.: Using MetaML: A Staged Programming Language. In: Launchbury, J., Sheard, T., Meijer, E. (eds.) AFP 1996. LNCS, vol. 1129, pp. 207–239. Springer, Heidelberg (1996)

    Google Scholar 

  6. MetaOCaml: A compiled, type-safe multi-stage programming language (2003), http://www.metaocaml.org/ (accessed September 13, 2011)

  7. Stroustrup, B.: The C++ Programming Language Special Edition. Addison-Wesley (2000)

    Google Scholar 

  8. Sheard, T.: Accomplishments and Research Challenges in Meta-programming. In: Taha, W. (ed.) SAIG 2001. LNCS, vol. 2196, pp. 2–44. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  9. Veldhuizen, T.: Using C++ template metaprograms. C++ Report 7(4), 36–43 (1995)

    Google Scholar 

  10. Abrahams, D., Gurtovoy, A.: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond. Addison-Wesley Professional (2004)

    Google Scholar 

  11. Porkolab, Z., Mihalicza, J., Sipos, A.: Debugging C++ template metaprograms. In: Proc. of GPCE 2006, pp. 255–264. ACM (2006)

    Google Scholar 

  12. Alexandrescu, A.: The D Programming Language. Addison-Wesley Professional (2010)

    Google Scholar 

  13. Descent: An Eclipse plugin providing an IDE for the D programming language, http://www.dsource.org/projects/descent (accessed September 13, 2011)

  14. Skalski, K., Moskal, M., Olszta, P.: Meta-programming in Nemerle (2004), http://nemerle.org/metaprogramming.pdf (accessed September 13, 2011)

  15. Sheard, T., Jones, S.P.: Template meta-programming for Haskell. In: Proceedings of the Haskell Workshop 2002. ACM (2002)

    Google Scholar 

  16. Bachrach, J., Playford, K.: D-expressions: Lisp power, dylan style (1999), http://www.ai.mit.edu/people/jrb/Projects/dexprs.pdf (accessed September 13, 2011)

  17. Fleutot, F.: Man Metalua (April 2007), http://metalua.luaforge.net/metalua-manual.html

  18. Tratt, L.: Compile-time meta-programming in a dynamically typed OO language. In: Proceedings Dynamic Languages Symposium, pp. 49–64 (October 2005)

    Google Scholar 

  19. Savidis, A.: Dynamic Imperative Languages for Runtime Extensible Semantics and Polymorphic Meta-Programming. In: Guelfi, N., Savidis, A. (eds.) RISE 2005. LNCS, vol. 3943, pp. 113–128. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  20. Savidis, A., Bourdenas, T., Georgalis, J.: An Adaptable Circular Meta-IDE for a Dynamic Programming Language. In: Proceedings of the 4th International Workshop on Rapid Integration of Software Engineering Techniques (RISE 2007), Luxemburg, November 26-27, pp. 99–114 (2007)

    Google Scholar 

  21. Taha, W.: A Gentle Introduction to Multi-stage Programming. In: Lengauer, C., Batory, D., Blum, A., Vetta, A. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 30–50. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Lilis, Y., Savidis, A. (2012). Supporting Compile-Time Debugging and Precise Error Reporting in Meta-programs. In: Furia, C.A., Nanz, S. (eds) Objects, Models, Components, Patterns. TOOLS 2012. Lecture Notes in Computer Science, vol 7304. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-30561-0_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-30561-0_12

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-30560-3

  • Online ISBN: 978-3-642-30561-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics