CS 476 Programming Language Design William Mansky Programming
- Slides: 28
CS 476 – Programming Language Design William Mansky
Programming Language Metatheory • We’ve used inference rules and proof trees to describe the behavior of programs • We can also use them to prove properties about the language itself! ― If a program is has a type, then its result has the same type ― Big-step and small-step semantics allow the same behaviors ― The interpreter correctly implements the language semantics 1
Programming Language Metatheory • We can also use them to prove properties about the language itself! ― If a program is has a type, then its result has the same type ― Big-step and small-step semantics allow the same behaviors ― The interpreter correctly implements the language semantics • The properties of the different systems that define the language are called its metatheory • Metatheory is (part of) why we bother with all these systems! ― We use a type system because it guarantees something about the execution of well-typed programs. ― We write semantics because it gives us a way of telling whether an interpreter is correct. 2
Metatheory #1: Type Safety • 3
Proving Progress: Rule Induction • 4
Proving Progress: Rule Induction • 5
Expressions: Types • Types: int, bool • Rules: 6
Proving Progress: Rule Induction • 7
Proving Progress: Rule Induction • 8
Proving Progress: Base Cases • 9
Proving Progress: Inductive Cases • 10
Proving Progress: Inductive Cases •
Proving Progress: Rule Induction • 12
Proving Preservation • 13
Proving Preservation: Base Cases • 14
Proving Preservation: Inductive Cases • 15
Expressions: Type Safety • 16
Small-Step vs. Big-Step Small-Step • Includes intermediate states • Allows control of evaluation order • Can count the number of steps Big-Step • Doesn’t need structural rules • Turns into a more direct interpreter • Sometimes internal steps don’t matter Why not both? 17
Big- and Small-Step Equivalence • 18
Big to Small: Base Cases • 19
Big to Small: Inductive Cases • 20
Big to Small: Inductive Cases • 21
Big to Small: Inductive Cases • 22
Big to Small: Inductive Cases • 23
Big to Small: Inductive Cases • 24
Big- and Small-Step Equivalence • 25
Small to Big • 26
Class Project (for 4 -credit students only) • Work alone or in group of 2 -3 • Project ideas: ― Read a paper about an interesting language/feature and write semantics or interpreter for it ― Define and implement a stronger/more interesting type system for an existing language ― Prove equivalence of two semantics for a language, by hand or mechanically ― Design and implement a small domain-specific language • Project proposal due 10/12, but email me anytime! 27
- William mansky
- William mansky
- William mansky
- Roman (500 b.c.– a.d. 476) art
- Cs 476
- Rounding key words
- 476 a 1453
- 476 a 1453
- Symmetrical components in power system pdf
- 476-1492
- 476 a 1453
- That "rome fell in a.d. 476" means
- What caused the fall of the roman empire
- 476 fighter group
- Hasil dari 476:17+41×12
- 476 bus times
- Ece 476
- Power systems
- Dhol
- Ie 476
- Ntp 854
- I.sz. 476
- Resolve
- Ece 476
- 476 ce
- Ece 476
- Ece 476
- Ece 476
- Ece 476