Techniques for implementing embedded domain specific languages in dynamic languages

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. (Less)

[1]  Paul Hudak,et al.  Arrows, Robots, and Functional Reactive Programming , 2002, Advanced Functional Programming.

[2]  Krzysztof Czarnecki,et al.  Generative programming - methods, tools and applications , 2000 .

[3]  Paul Hudak,et al.  Building domain-specific embedded languages , 1996, CSUR.

[4]  Donald D. Chamberlin,et al.  SEQUEL: A structured English query language , 1974, SIGFIDET '74.

[5]  Lennart Ohlsson,et al.  Implementing an embedded GPU language by combining translation and generation , 2006, SAC.

[6]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[7]  Enhua Wu,et al.  Real-time 3D fluid simulation on GPU with complex obstacles , 2004, 12th Pacific Conference on Computer Graphics and Applications, 2004. PG 2004. Proceedings..

[8]  Paul Hudak,et al.  Modular domain specific languages and tools , 1998, Proceedings. Fifth International Conference on Software Reuse (Cat. No.98TB100203).

[9]  Pat Hanrahan,et al.  A language for shading and lighting calculations , 1990, SIGGRAPH.

[10]  William R. Mark,et al.  Cg: a system for programming graphics hardware in a C-like language , 2003, ACM Trans. Graph..

[11]  Jitendra Malik,et al.  Scale-Space and Edge Detection Using Anisotropic Diffusion , 1990, IEEE Trans. Pattern Anal. Mach. Intell..

[12]  Rüdiger Westermann,et al.  Linear algebra operators for GPU implementation of numerical algorithms , 2003, SIGGRAPH Courses.

[13]  Jonathan D. Cohen,et al.  A relational debugging engine for the graphics pipeline , 2005, SIGGRAPH '05.

[14]  Henri E. Bal,et al.  Orca: A Language For Parallel Programming of Distributed Systems , 1992, IEEE Trans. Software Eng..

[15]  Adam Finkelstein,et al.  Real-time fur over arbitrary surfaces , 2001, I3D '01.

[16]  Patrick Pérez,et al.  Poisson image editing , 2003, ACM Trans. Graph..

[17]  Lennart Ohlsson,et al.  A scripting tool for real-time effect programming , 2005 .

[18]  Murray Hill,et al.  Yacc: Yet Another Compiler-Compiler , 1978 .

[19]  Ken Perlin,et al.  An image synthesizer , 1988 .

[20]  Robert L. Cook,et al.  Shade trees , 1984, SIGGRAPH.

[21]  Michael D. McCool,et al.  Shader metaprogramming , 2002, HWWS '02.

[22]  Sean Whalen Audio and the Graphics Processing Unit , 2005 .

[23]  Conal Elliott,et al.  Programming graphics processors functionally , 2004, Haskell '04.

[24]  Richard L. White,et al.  numarray : A New Scientific Array Package for Python , 2003 .

[25]  James Jennings,et al.  Verischemelog: Verilog embedded in Scheme , 1999, DSL '99.

[26]  Cyril S. Ku,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.

[27]  John G. Eyles,et al.  PixelFlow: high-speed rendering using image composition , 1992, SIGGRAPH.

[28]  James F. Blinn,et al.  Simulation of wrinkled surfaces , 1978, SIGGRAPH.

[29]  Pat Hanrahan,et al.  Brook for GPUs: stream computing on graphics hardware , 2004, ACM Trans. Graph..

[30]  Oege de Moor,et al.  Compiling embedded languages , 2000, Journal of Functional Programming.

[31]  Edward Jones The dBASE Language Reference , 1990 .

[32]  Pat Hanrahan,et al.  A real-time procedural shading system for programmable graphics hardware , 2001, SIGGRAPH.

[33]  Mary Sheeran,et al.  Lava: hardware design in Haskell , 1998, ICFP '98.

[34]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[35]  Eric Schenk,et al.  Shader-driven compilation of rendering assets , 2002, ACM Trans. Graph..

[36]  Armin Rigo,et al.  Representation-based just-in-time specialization and the psyco prototype for python , 2004, PEPM '04.

[37]  Guy L. Steele,et al.  Java(TM) Language Specification , 2005 .

[38]  Michael D. McCool,et al.  Shader algebra , 2004, ACM Trans. Graph..

[39]  Anselmo Lastra,et al.  A shading language on graphics hardware: the pixelflow shading system , 1998, SIGGRAPH.

[40]  Paul Hudak,et al.  Haskore music notation – An algebra of music – , 1996, Journal of Functional Programming.

[41]  Gerald J. Sussman,et al.  Structure and interpretation of computer programs , 1985, Proceedings of the IEEE.