Mixed-level embedding and JIT compilation for an iteratively staged DSL

  • Authors:
  • George Giorgidze;Henrik Nilsson

  • Affiliations:
  • Functional Programming Laboratory, School of Computer Science, University of Nottingham, United Kingdom;Functional Programming Laboratory, School of Computer Science, University of Nottingham, United Kingdom

  • Venue:
  • WFLP'10 Proceedings of the 19th international conference on Functional and constraint logic programming
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper explores how to implement an iteratively staged domain-specific language (DSL) by embedding into a functional language. The domain is modelling and simulation of physical systems where models are expressed in terms of non-causal differential-algebraic equations; i.e., sets of constraints solved through numerical simulation. What distinguishes our language is that the equational constraints are first class entities allowing for an evolving model structure characterised by repeated generation of updated constraints. Hence iteratively staged. Our DSL can thus be seen as a combined functional and constraint programming language, albeit a two-level one, with the functional language chiefly serving as a meta language. However, the two levels do interact throughout the simulation. The embedding strategy we pursue is a mixture of deep and shallow, with the deep embedding enabling justin-time (JIT) compilation of the constraints as they are generated for efficiency, while the shallow embedding is used for the remainder for maximum leverage of the host language. The paper is organised around a specific DSL, but our implementation strategy should be applicable for iteratively staged languages in general. Our DSL itself is further a novel variation of a declarative constraint programming language.