Results 1 -
1 of
1
From Interpreter to Compiler using Staging and Monads
, 1998
"... In writing this paper we had two goals. First, to promote MetaML, a programming language for writing staged programs, and second, to demonstrate that staging a program can have significant benefits. We do this by example: the derivation of an executable compiler for a small language. We derive the c ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
In writing this paper we had two goals. First, to promote MetaML, a programming language for writing staged programs, and second, to demonstrate that staging a program can have significant benefits. We do this by example: the derivation of an executable compiler for a small language. We derive the compiler in a rigorous fashion from a semantic description of the language. This is done by staging a denotational semantics, expressed as a monadic interpreter. The compiler is a program generator, taking a program in the source language "a while-program" as input and producing an ML program as target. The ML program produced is in a restricted subset of ML over which the programmer has complete control. It is encapsulated in a special data-structure called code. The meta-programming capabilities of MetaML allow this data-structure to be directly executed "run-time code generation", or to be analysed. We illustrate this analysis of generated code to build a source to source transf...

