Type Checking C++ Template Instantiation by Graph Programs

Authors

  • Karl Azab
  • Karl-Heinz Pennemann

DOI:

https://doi.org/10.14279/tuj.eceasst.10.148

Abstract

Templates are a language feature of C++ and can be used for metaprogramming. The metaprogram is executed by the compiler and outputs source code which is then compiled. Templates are widely used in software libraries but few tools exist for programmers developing template code. In particular, error messages are often cryptic. During template instantiation, a compiler looks up names that depend on a template's formal parameters. We use graphs to represent the relevant parts of the source code and a graph program for the name lookup and type checking for expressions involving such names. This technique provides compiler writers with a visual way of writing algorithms that generate error messages and forms the basis for a visual inspection of type problems and suggested remedies for the programmer. Our graph program terminates and emits correct error messages.

Downloads

Published

2008-07-14

How to Cite

[1]
K. Azab and K.-H. Pennemann, “Type Checking C++ Template Instantiation by Graph Programs”, eceasst, vol. 10, Jul. 2008.