COP 4020 Lecture -*- Outline -*- * Declarative Computation Model (Ch 2) Based on Peter van Roy and Seif Haridi's book, "Concepts, Techniques, and Models of Computer Programming" (MIT Press, 2004), where all references that are not otherwise attributed are found. ** self-test ------------------------------------------ SELF-TEST FOR CHAPTER 2 Defining languages [Concepts] How are languages defined? Syntax [Concepts] Give an EBNF grammar for phone numbers of the form 555-1212. Semantics [Concepts] What is one way to give meaning to a programming language? Why is it precise? Data structures in the model [Concepts] [UseModels] What is a single-assignment store? What are (declarative) variables? What are the values in the declarative model? What is a partial value? What is a store entity? What is a dataflow variable? Semantics of Statements [Concepts] [UseModels] What is the meaning of: X = Y X = true proc {$ X Y Z} Z = X+Y end Operations [Concepts] [UseModels] What is the difference between X = Y and X == Y ? Scoping [Concepts] What is static scoping? Why is it useful for reasoning? What is the meaning of the procedure local X in X = 541 proc {$ Y Z} Z = X+Y end end What does it mean with dynamic scoping? What are the free identifiers in proc {$ Y Z} Z = X+Y end ? What are the free identifiers in {proc {$ Y Z} Z = X+Y end X Q} ? Dataflow [Concepts] [UseModels] What is the meaning of local Z in {proc {$ Y Z} Z = X+Y end 3 Z {Browse Z} end Why is dataflow behavior sensible? In what way does dataflow behavior make debugging difficult? Abstract Machine [Concepts] How does the abstract machine work, in general terms? Pattern Matching [UseModels] How is pattern matching done by case? Static scoping [Concepts] How is static scoping realized in the abstract machine? Memory organization [Concepts] [UseLanguages] [MapToLanguages] How is memory organized to represent the environment and store? What is an activation record? Why is an activation record needed for every *call* of a procedure? How are local variables accessed from within an activation record? Last call optimization [Concepts] [EvaluateModels] What is last call optimization? Why is it useful? Garbage Collection [Concepts] [EvaluateModels] How can you prevent storage from being collected? Sugars and abstractions [Concepts] [UseModels] What is the difference between a syntactic sugar and a linguistic abstraction? What sugars does Oz have? What does the "$" nesting marker do? How are function definition desugared into procedure definitions? How are their calls desugared? Exceptions [Concepts] [UseModels] [UseLanguages] Why does a language need an explicit exception mechanism? What values are used in Oz for exceptions? What happens if both an exception is thrown in a try and a raise is thrown in a finally clause? Functional Languages [Concepts] What is the lambda calculus? How is it related to the declarative model? What restrictions eliminate the need for unbound variables? Unification [Concepts] What does the unification algorithm do? How can cyclic structures arise? Typing [Concepts] How is strong typing different from static typing? What are the advantages of dynamic typing? ------------------------------------------