Georgia Institute of Technology
Atlanta, Georgia 30332, USA
This paper presents the design of a domain-specific language processor that takes in a collection of first-order algebraic, differential or difference equations as input, and produces an executable that performs a real-time numerical simulation of the model described by these equations.
Domain-specific languages are a general software engineering approach that in this case allow for easy encoding of a wide variety of target APIs, and for clean encapsulation and separation of the user model from the surrounding operating system and simulation environment.
A key feature of the design is the intermediate language, which is a variant of lambda calulus augmented with semantics for memory allocation that allow the compiler to generate a static representation of the heap used by the model, and guarantee that all memory operations throughout the simulation are constant-time. The design outlined here uses type-preserving transformations that guarantee that given a syntactically correct input model, the generated output code is type correct, and by extension memory safe.
The paper concludes by showing an example of extending the user input language with support for asynchronous events, and using the example as way of anecdotal evidence for the extensibility and flexibility of the system.
This paper was originally presented at the Eighth Real-Time Linux Workshop held at the at the School for Information Science and Engineering, Lanzhou University, in Lanzhou, China.