Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 34: Finishing the Interpreter

Class 34: Finishing the Interpreter

cs1120: Introduction to Computing
Explorations in Language, Logic, and Machine
University of Virginia, Spring 2016

http://xplorecs.org/class34

Class 34:
Finishing the Interpreter
(Ink Lost)

David Evans

April 20, 2016
Tweet

More Decks by David Evans

Other Decks in Programming

Transcript

  1. Class 34: Finishing the Interpreter Introduction to Computing: Explorations in

    Language, Logic, and Machines cs1120 Spring 2016 David Evans University of Virginia
  2. Schedule Update Red Belt Exam: Covers Projects 1-6 Readings including

    Ch 11 and Ch 12 Includes everything at Blue Belt level plus: Classes, Objects, and Types Interpreters Modeling Computation (Turing Machines, Finite State Machines) Computability (Chapter 12 and Friday and Monday’s Classes) First opportunity starts Monday My office hours Thursday are canceled, Yuchi will hold extra office hours Thursday, 4-5pm in Rice 514 Next week: No office hours Tuesday Extra (Dave) office hours Wednesday, 10:30am-noon
  3. To apply a constructed procedure: 1.Construct a new environment, whose

    parent is the environment of the applied procedure. 2.For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3.Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application. Stateful Application Rule
  4. Church-Turing Thesis A Turing Machine (or Lambda Calculus) can simulate

    any “mechanical computer”. Alonzo Church, 1903-1995 Alan Turing, 1912-1954 8 All mechanical computers are equally powerful (except for practical limits like memory size, time, display, energy, etc.)
  5. Church-Turing Thesis Is this a statement that can be proved

    true or false? Alonzo Church, 1903-1995 Alan Turing, 1912-1954 11 All mechanical computers are equally powerful (except for practical limits like memory size, time, display, energy, etc.)
  6. To apply a constructed procedure: 1.Construct a new environment, whose

    parent is the environment of the applied procedure. 2.For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3.Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application. Stateful Application Rule
  7. To apply a constructed procedure: 1. Construct a new environment,

    whose parent is the environment of the applied procedure. 2. For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the applicationand initialize the value in each place to the value of the corresponding operand expression. 3. Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application.
  8. 14

  9. 15 To apply a constructed procedure: 1. Construct a new

    environment, whose parent is the environment of the applied procedure. 2. For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3. Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application. How should we construct the new environment?
  10. To apply a constructed procedure: 1. Construct a new environment,

    whose parent is the environment of the applied procedure. 2. For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3. Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application.
  11. To apply a constructed procedure: 1. Construct a new environment,

    whose parent is the environment of the applied procedure. 2. For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3. Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application.
  12. To apply a constructed procedure: 1. Construct a new environment,

    whose parent is the environment of the applied procedure. 2. For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3. Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application.
  13. To apply a constructed procedure: 1. Construct a new environment,

    whose parent is the environment of the applied procedure. 2. For each procedure parameter, create a place in the frame of the new environment with the name of the parameter. Evaluate each operand expression in the environment of the application and initialize the value in each place to the value of the corresponding operand expression. 3. Evaluate the body of the procedure in the newly created environment. The resulting value is the value of the application.
  14. Charge • Project 6: target completing by Friday • First

    possibility of starting Red Belt test on Monday