Techniques for implementing embedded domain specific languages in dynamic languages
Abstract (Summary)Computer programming should be expressing the complicated in easily understandable parts. General languages provide tools and abstractions that allow many different problems to be formulated and solved. Unfortunately, these abstraction only rarely match the problem area precisely, resulting in solutions that are obscured by the need for support code unrelated to the problem. This can be avoided, by constructing a language tailored to the specific problem, solutions can be expressed more clearly, resulting in programs that are easy to read, debug, and maintain. Designing a new language from scratch, however, is a costly venture, which has hindered the adoption of such domain specific languages (DSLs). In this thesis, we explore and describe methods for constructing and implementing DSLs. By using an existing host language, DSLs can be implemented as embedded languages, inheriting the syntax and capabilities of the host language. We argue that the embedded language approach to implementing DSLs gives many benefits over traditional language implementation techniques. Furthermore, by using a dynamic programming language as host, we can take advantage of the high-level nature of such a language; both to facilitate the implementation of the DSL and to provide high-level programming constructs in the DSL. This thesis describes two prototype languages; PyFX and PyGPU, both embedded in Python, for programming and controlling different aspects of modern graphics cards. PyFX is a language for constructing real-time graphics effects. It views effects as active entities, allowing them to be expressed concisely and clearly, without introducing the glue-code requirements of previous approaches. The second language, PyGPU, is targeted at writing high-level image processing algorithms that execute on the high performing graphics processing unit (GPU) present on modern graphics cards. PyGPU uses a combination of a high-level image abstraction and a novel compilation strategy to translate high-level PyGPU code to efficient native code running on the GPU.
Source Type:Master's Thesis
Date of Publication:01/01/2006