Program templates: expression templates applied to program evaluation

From LRDE

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Abstract

The C++ language provides a two-layer execution model: static execution of meta-programs and dynamic execution of resulting programs. The Expression Templates technique takes advantage of this dual execution model through the construction of C++ types expressing simple arithmetic formulas. Our intent is to extend this technique to a whole programming language. The Tiger language is a smallimperative language with types, variables, arrays, recordsow control structures and nested functions. The rst step is to show how to express a Tiger program as a C++ type. The second step concerns operational analysis which is done through the use of meta-programs. Finally an implementation of our Tiger evaluator is proposed. Our technique goes much deeper than the Expression Templates one. It shows how the generative power of C++ meta-programming can be used in order to compile abstract syntax trees of a fully featured programming language.


Bibtex (lrde.bib)

@InProceedings{	  maes.03.dpcool,
  author	= {Francis Maes},
  title		= {Program templates: expression templates applied to program
		  evaluation},
  booktitle	= {Proceedings of the Workshop on Declarative Programming in
		  the Context of Object-Oriented Languages (DP-COOL; in
		  conjunction with PLI)},
  year		= 2003,
  address	= {Uppsala, Sweden},
  number	= {FZJ-ZAM-IB-2003-10},
  pages		= {67--86},
  editor	= {J\"org Striegnitz and Kei Davis},
  month		= aug,
  series	= {John von Neumann Institute for Computing (NIC)},
  abstract	= {The C++ language provides a two-layer execution model:
		  static execution of meta-programs and dynamic execution of
		  resulting programs. The Expression Templates technique
		  takes advantage of this dual execution model through the
		  construction of C++ types expressing simple arithmetic
		  formulas. Our intent is to extend this technique to a whole
		  programming language. The Tiger language is a small,
		  imperative language with types, variables, arrays, records,
		  ow control structures and nested functions. The rst step is
		  to show how to express a Tiger program as a C++ type. The
		  second step concerns operational analysis which is done
		  through the use of meta-programs. Finally an implementation
		  of our Tiger evaluator is proposed. Our technique goes much
		  deeper than the Expression Templates one. It shows how the
		  generative power of C++ meta-programming can be used in
		  order to compile abstract syntax trees of a fully featured
		  programming language.}
}