Quasiquotation - Lab
From doing these activities students will
- See Quasiquotation as a tool for extending the haskell compiler with custom concrete syntax in action
In class Announcements - 5 min (9:00 ~ 9:05)
Warm-up activity - 10 min (9:05 ~ 9:15)
Build a concept map with these vocabulary words as nodes. Feel free to introduce intermediate nodes as needed.
- Quasiquoter
- Concrete syntax
- Abstract Syntax
- Parser Combinators
- Haskell Abstract Syntax
- Abstraction
- Representation
- Algebraic Data Type
- Q Monad
- IO
- Library Code
- Compile Time
- Run Time
E.g. Q Monad -| can expose |-> IO
Groups and Roles
Scribes
- Take notes for your group to contribute to the wiki page for the discussion
- A head scribe will go and write a summary on that page for an extra credit point
Managers
- Keep track of time
- Make a role ticket on the Reading repo for everyone in your group
Ambassadors
- Presents the unified thoughts of their group
- Talks with instructors at the end about meta class management
Small group discussion - 20 min (9:15 ~ 9:35)
You have the functions from previous homeworks and the current tooling for
Quasiquotation and Template Haskell. Implement a DSL that allows users to:
- write arithmetic expressions in a prefix concrete syntax
- reference haskell variables that would be in scope at the expression
- evaluate the expressions at compile time doing constant folding
You don't have to be too explicit, pseudocode is sufficient. We will code it together,
just have enough detail of how you would change the homework code to both
support these new features and also package them up in a quasiquoter.
Large group discussion - 30min (9:35 ~ 10:05)
Reconvene and go over answers.
Cool-down activity - 10 min (10:05 ~ 10:15)
All scribes will get together to start their wiki write up to be finished
at latest a week from today.
All managers will get together and make tickets for the course.
This can include the tickets from their group discussions as mentioned above,
a ticket to follow up on the scribe write up, and any other issues they
think will be helpful.
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