Domain Specific Languages

From doing these activities students will

Warm-up activity - 15 min

Think - 5 min

The type Integer represents integer numbers with no max or min (unbounded). Consider these two functions that operate over Integers toInteger :: (Integral a) => a -> Integer and fromInteger :: (Num a) => Integer -> a. Like the Num typeclass which defines methods like + and *, the Integral typeclass defines methods like div (integer division) and mod

We often use these two functions to convert values from one numeric type to another (casting). E.g. (fromInteger (toInteger (3 :: Word8))) :: Word16

Casting a number to a type that is too small to hold it will cause it to overflow. Similarly a number may underflow.

What type ascriptions (::'s) could you add to the following haskell expression to make the expression evaluate to the number 32512. The reference solution uses the types Int16 Word8 and Int32.

maxbound - ((fromInteger (toInteger maxBound)) + (fromInteger (toInteger minBound)))

(maxBound :: Int16) - ( ((fromInteger (toInteger (maxBound :: Word8))) :: Int16) + ( (fromInteger (toInteger (minBound :: Int32))) :: Int16))

Pair - 5 min

With a neighbor, discuss your answers. Please write both of your names and your answer on one sheet of paper

Share and Answer - 5 min

Pairs may volunteer a solution, and the reference solution will be given. Please turn in your attendance papers.

To standalone or not to standalone; that is the design decision

Matthew will hand out edited copies of select "Programming Languages in the Wild" hw entries. The student whose entries are chosen will be ambassadors for a group. Entries are selected on the impression of what will foster rich discussion; groups are assigned by Matthew based on language likeness in your submissions.

Groups and Roles

Groups

Python

Javascript

OCAML

BASIC

Clojure

Julia

Elixir

TikZ

CMAKE

Roles

Scribes

Managers

Ambassadors

Small group discussion - 30 min

Take a few minutes to discuss what the language is and its features.

Answer the following discussion question that pertain to your language:

Considering your answers above, synthesize a checklist or a flowchart detailing what initial design decisions a language designer should make before starting a domain specific language. Specifically, your flowchart should help a language designer answer either of these questions:

Large group discussion - 15min

Ambassadors will take turns discussing their group's design process before opening the floor to the rest of the class.

Cool-down activity - 10 min

All scribes will be tasked with commiting their group's design process to the Reading Wiki. The head scribe will be in charge of combining the results into an organized and focused entry for reference in future discussion.

All managers will get together and make tickets for the course. Especially any noted questions that remained unanswered during the class.

All ambassadors will get together with Matthew and Kathleen and discuss how they think the day went, how they think the pacing went, what they are looking forward to, any worries they might have about the class, etc.

Class Dismissed