Domain-specific Languages

Presented by Owen Landgren

Transcribed by Mike MacHenry

Define a DSL as a language that simplifies a complex task dependent on outside information


PICdifficult (learn all different languages)
Lex, Yaccreimplementation

Erann Gat '92,'97

Robot Control

We need a way to computer errors in the code. Communicate failure to the outside world. Robot can't just go nuts when exceptions are raised.

(fail cause . args)

(with-recovery-procedures (f rest . clauses))


Shivers '94,'96


Mawldescribing forms
JSTmanipulate AST's

We have the idea but we don't know how to put it together

How do you design a DSL? How do you implement a DSL?

Hudak '96, '98

Define a core language λ and build layers on top of it. We have layers on top. "Update", above which is "call/cc", above which is "environments" From env's and call/cc we get assignment.

Hudak puts them into a monad to allow the languages to be composed. Now we can add features to get new languages.

Fran - functional reactive animation


scale vp

p1 over p2

type Animation = Time -> Picture
type Behavior = Time -> a
type Animation = Behavior Picture

Now that it's "lifted" we can scale over behavior

(scaleB v b) p = (scale (v t) (b t)) where v is a vector, b a behavior, and t a time

Faith, Nyland, Pring '92

A domain-specific language is three things

  1. Generate an AST from syntax
  2. Manipulate it
  3. Print out a new program

source -> source transformation

DSL transformations look a lot like compiler designs now. Khypa provides tools for AST definition, pretty printing, transform rules, and transform sequences