Lecture 1: CalcLang
Code:
Lecture outline
- Programming in Plait
- Built-in types, data, functions, definitions
- Datatype definitions
- Type-case
- Intro to defining programming languages
- Syntax
- BNF grammars
- S-expressions
- Plait datatypes
- Operational semantics
- A definitional interpreter
- Adding strings
- Operator overloading
- Discussion
- Meta-languages and object languages
Exercises/TPS
- Where are some places that ambiguity shows up in surface syntax?
- Write the AST for the expression
((2+1) * 3)
- Write Plait defns of type CalcLang to represent
1 + 2
(2 + 1) * 3
- How could we extend the language with strings? (write new datatype and example term)
Bibliography
- Reynolds, John (1998). Definitional Interpreters for Higher-Order Programming Languages.
https://homepages.inf.ed.ac.uk/wadler/papers/papers-we-love/reynolds-definitional-interpreters-1998.pdf
- Landin, Peter J. (1965). The Next 700 Programming Languages. https://homepages.inf.ed.ac.uk/wadler/papers/papers-we-love/landin-next-700.pdf
- McCarthy, John (1963). A Basis for a Mathematical Theory of Computation. https://www-formal.stanford.edu/jmc/basis1.pdf