Share
Embed
Class 34: Finishing the Interpreter
cs1120: Introduction to Computing
Explorations in Language, Logic, and Machine
University of Virginia, Spring 2016
Class 34:
Finishing the Interpreter
(Ink Lost)
David Evans
April 20, 2016
Transcript
23 slides
-
Class 34: Finishing the Interpreter Introduction to Computing: Explorations in
Language, Logic, and Machines cs1120 Spring 2016 David Evans University of Virginia -
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 -
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 -
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.) -
Equally Powerful? How can we define the power of a
computing machine? -
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.) -
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 -
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. -
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? -
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. -
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. -
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. -
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. -
Charge • Project 6: target completing by Friday • First
possibility of starting Red Belt test on Monday