Sham: A DSL for Fast DSLs

05/18/2020
by   Rajan Walia, et al.
0

Domain-specific languages (DSLs) are touted as both easy to embed in programs and easy to optimize. Yet these goals are often in tension. Embedded or internal DSLs fit naturally with a host language, while inheriting the host's performance characteristics. External DSLs can use external optimizers and languages but sit apart from the host. We present Sham, a toolkit designed to enable internal DSLs with high performance. Sham is itself a DSL embedded in Racket, but compiles transparently to LLVM at runtime. Sham is designed to be well suited as both a compilation target for other DSLs embedded in Racket as well as a language for transparently replacing DSL support code with faster versions. Sham programs interoperate seamlessly with Racket programs, and so no additional effort is required to use a DSL implemented with Sham. Finally, Sham comes with a framework for defining DSL compilers and transformations, which is also used in the implementation of Sham itself. We validate Sham's design on a series of case studies, ranging from Krishnamurthi's classic automata DSL to a sound synthesis DSL and a probabilistic programming language. All of these are existing DSLs where we replaced the backend using Sham, resulting in major performance gains.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/22/2021

Choosing is Losing: How to combine the benefits of shallow and deep embeddings through reflection

Dependently-typed host languages empower users to verify a wide range of...
research
02/26/2021

LazyTensor: combining eager execution with domain-specific compilers

Domain-specific optimizing compilers have demonstrated significant perfo...
research
06/18/2020

Compositional theories for embedded languages

Embedded programming style allows to split the syntax in two parts, repr...
research
09/29/2021

Unified Shader Programming in C++

In real-time graphics, the strict separation of programming languages an...
research
12/01/2020

Customizing Host IDE for Non-programming Users of Pure Embedded DSLs: A Case Study

Pure embedding as an implementation strategy of domain-specific language...
research
02/26/2022

Semantic Soundness for Language Interoperability

Programs are rarely implemented in a single language, and thus questions...
research
09/19/2022

Is Rust C++-fast? Benchmarking System Languages on Everyday Routines

Rust is a relatively new system programming language that has been exper...

Please sign up or login with your details

Forgot password? Click here to reset