본문 바로가기

학교/CPL16

CPL 4: Mutation and State case LetRecExt(binds, body) => { val newBody = binds.reverse.foldLeft(desugar(body)) { case (accBody, bind) => SeqC(SetC(bind.name, desugar(bind.value)), accBody) } AppC(FdC(binds.map(_.name), newBody), binds.map(bind => UninitializedC()))}-----------------------------------------------------------------------------------case IdC(c) => { val loc = lookup(c, nv) val value = fetch(loc, st1.. 2024. 4. 5.
Lecture 7-8: Mutation and State 목차 Learning Objectives - Explain how pointers work and how memory can be interpreted in different ways - Explain the differences between pass-by-reference and pass-by-value - Explain the differences between pure and impure languages - Understand the concept of stores and as an model for memory - Explain different methods to solve the problem of garbage - Implement a definitional interpreter with.. 2024. 4. 1.
CPL 3: Function Interpretation and Environments 목차 Environments Basic Functions Environments represent the bindings available at different locations. Environment = list of bindings Bind is a case class (ADT) Bind(name: String, value: Value) E.g. Environment = [Bind("x", NumV(3)), Bind("y", NumV(5))] Difference between maps: environments allow for duplicate keys → allow access to shadowed bindings 1. add() def add(myEnv: Environment, name: Str.. 2024. 3. 31.
Lecture 6: Environments and Scoping 목차 Learning Objectives - Explain what a "law" is - Explain how to verify that a programming language interpreter satisfies a law - Explain laws that uniquely characterize (simply-typed) functions What is a "Law"? An abstraction can be understood and defined independently of its underlying implementation Abstract definition = syntax + laws A law is an equation between two terms Example: → 왼쪽이 Syn.. 2024. 3. 29.
반응형