Results 1 -
2 of
2
Multi-stage programming with functors and monads: eliminating abstraction overhead from generic code
, 2008
"... ..."
Scrapping your Inefficient Engine: using Partial Evaluation to Improve Domain-Specific Language Implementation
"... Partial evaluation aims to improve the efficiency of a program by specialising it with respect to some known inputs. In theory, it is a natural match to language implementation, in that partially evaluating an interpreter with respect to a specific source program yields an efficient translation of t ..."
Abstract
- Add to MetaCart
Partial evaluation aims to improve the efficiency of a program by specialising it with respect to some known inputs. In theory, it is a natural match to language implementation, in that partially evaluating an interpreter with respect to a specific source program yields an efficient translation of that program. In practice, however, there can be difficulties — we must consider e.g. binding-time improvements, function calls, recursion, code duplication, and how to deal with side-effects. These difficulties limit the practical benefits of partial evaluation and have limited its widespread adoption. In this paper, we show that partial evaluation can be an effective and, unusually, straightforward technique for the efficient implementation of domain-specific languages. We achieve this by exploiting dependent types and by following some simple rules in the definition of the interpreter. We present experimental evidence that partial evaluation of programs in domain-specific languages yields efficient residual programs whose performance is competitive with their Java and C equivalents and which are also, through the use of dependent types, verifiably resource-safe. Using our technique, it follows that a verifiably correct and resource-safe program can also be an efficient program. 1.

