Dynamic symbolic computation for domain-specific language implementation

Abstract

A domain-specific language (DSL) is a specification language designed to facilitate programming in a certain application domain. A well-designed DSL reflects the natural structure of the modeled domain, enforces abstraction, and its implementation exploits domain-specific properties for safety and performance. Expounding on the latter, in this paper we describe a simple, but powerful method for gradually enhancing a base implementation with computational performance improvements. It consists of adding constructors for expensive operations if this facilitates asymptotic performance improvements in some contexts, with at most constant-factor overhead. The resulting implementation can be thought of as executing "standard" computation steps from the base implementation interleaved with symbolic computation steps on the newly introduced constructors. Evaluation of constructor expressions is lazy in a strong sense: It does not only delay evaluation by thunkifying its standard evaluation, but performs run-time inspection to evaluate constructor expressions in a nonstandard way. Extending earlier work by Henglein and Larsen [1] on generic multiset programming we arrive at novel multiset representations with constructors for unions, Cartesian products, scalar multiplication, and mapping binary functions over Cartesian products. We show how the resulting implementation can be used to implement finite probability distributions with exact (rational) probabilities. It supports computing both the expected value and, what we believe to be novel, the variance of random variables over n-ary product distributions efficiently by avoiding enumeration of the product sample space.

Original languageEnglish
Title of host publicationLogic-Based Program Synthesis and Transformation : 21st International Symposium, LOPSTR 2011, Odense, Denmark, July 18-20, 2011. Revised Selected Papers
EditorsGermán Vidal
Number of pages21
PublisherSpringer
Publication date2012
Pages4-24
ISBN (Print)978-3-642-32210-5
ISBN (Electronic)978-3-642-32211-2
DOIs
Publication statusPublished - 2012
Event21st International Symposium on Logic-Based Program Synthesis and Transformation - Odense, Denmark
Duration: 18 Jul 201120 Jul 2011
Conference number: 21

Conference

Conference21st International Symposium on Logic-Based Program Synthesis and Transformation
Number21
Country/TerritoryDenmark
CityOdense
Period18/07/201120/07/2011
SeriesLecture notes in computer science
Volume7225
ISSN0302-9743

Fingerprint

Dive into the research topics of 'Dynamic symbolic computation for domain-specific language implementation'. Together they form a unique fingerprint.

Cite this