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).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Kernighan, B.W., Ritchie, D.M.: The C programming language. Prentice-Hall, Englewood Cliffs (1988)
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)
Martel, M., Sheard, T.: Introduction to multi-stage programming using MetaML. Technical report, OGI, Portland, OR, 211, 213 (September 1997)
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)
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)
MetaOCaml: A compiled, type-safe multi-stage programming language (2003), http://www.metaocaml.org/ (accessed September 13, 2011)
Stroustrup, B.: The C++ Programming Language Special Edition. Addison-Wesley (2000)
Sheard, T.: Accomplishments and Research Challenges in Meta-programming. In: Taha, W. (ed.) SAIG 2001. LNCS, vol. 2196, pp. 2–44. Springer, Heidelberg (2001)
Veldhuizen, T.: Using C++ template metaprograms. C++ Report 7(4), 36–43 (1995)
Abrahams, D., Gurtovoy, A.: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond. Addison-Wesley Professional (2004)
Porkolab, Z., Mihalicza, J., Sipos, A.: Debugging C++ template metaprograms. In: Proc. of GPCE 2006, pp. 255–264. ACM (2006)
Alexandrescu, A.: The D Programming Language. Addison-Wesley Professional (2010)
Descent: An Eclipse plugin providing an IDE for the D programming language, http://www.dsource.org/projects/descent (accessed September 13, 2011)
Skalski, K., Moskal, M., Olszta, P.: Meta-programming in Nemerle (2004), http://nemerle.org/metaprogramming.pdf (accessed September 13, 2011)
Sheard, T., Jones, S.P.: Template meta-programming for Haskell. In: Proceedings of the Haskell Workshop 2002. ACM (2002)
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)
Fleutot, F.: Man Metalua (April 2007), http://metalua.luaforge.net/metalua-manual.html
Tratt, L.: Compile-time meta-programming in a dynamically typed OO language. In: Proceedings Dynamic Languages Symposium, pp. 49–64 (October 2005)
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)