WG211/M12Rhiger

From WG 2.11
Revision as of 19:12, 30 May 2013 by Ups (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Towards static compilation of dynamic code generation by Morten Rhiger

Multi-stage languages provide first-class code fragments that can be constructed, composed, and executed dynamically at runtime.

We present a translation from a typed multi-stage source language to multi-stage target code. The source language is high level: It represents variables (including variables in code fragments) by their name. The target code is low level: It represents variables (including variables in code fragments) by their memory location.

This translation, therefore, is one step towards multi-stage languages that compile code fragments statically at compile time rather than dynamically at runtime.

The translation is based on a simple type system for multi-stage languages and an observation that the code type of this type system precisely characterizes the memory layout of code fragments.