Type Checking C++ Template Instantiation by Graph Programs

  • 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 andTemplates 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.show moreshow less

Download full text files

Export metadata

  • Export Bibtex
  • Export RIS

Additional Services

Share in Twitter Search Google Scholar
Metadaten
Author: Karl Azab, Karl-Heinz Pennemann
URN:urn:nbn:de:kobv:83-opus-19994
ISBN:1863-2122
Series (Serial Number):Electronic Communications of the EASST- ECEASST (10/19)
Document Type:Wissenschaftlicher Artikel, Postprint
Language:English
Date of Publication (online):2008/08/28
Release Date:2008/08/28
Tag:C++; Graph Transformation; Graph programs; Type checking
Source:http://eceasst.cs.tu-berlin.de/index.php/eceasst/issue/view/19
Institutes:Institut für Softwaretechnik und Theoretische Informatik
Dewey Decimal Classification:004 Datenverarbeitung; Informatik
Collection:Volume 10 (2008): Graph Transformation and Visual Modeling Techniques 2008
Licence (German):License Logo CC BY-NC-SA: Creative Commons-Lizenz: Namensnennung, nicht kommerziell, Weitergabe zu gleichen Bedingungen