• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/13

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

13 Cards in this Set

  • Front
  • Back

static environment

The types of the preceding bindings in a file

dynamic environment

The values of the preceding bindings in a file

syntax

How an expression is written

semantics


How an expressions is type-checked and evaluated

type-check a variable binding

we use the “current static environment” (the types of preceding bindings) to type-check e (which will depend on what kind of expression it is) and produce a “new static environment” that is the current static environment except with x having type t where t is the type of e

evaluate a variable binding

use the “current dynamic environment” (the values of preceding bindings) to evaluatee (which will depend on what kind of expression it is) and produce a “new dynamic environment” that is the current environment except with x having the value v where v is the result of evaluating e

value

An expression that can not be simplified

integer constant


(syntax,type-checking,evaluation)

· Syntax: a sequence of digits


· Type-checking: type int in any static environment



· Evaluation: to itself in any dynamic environment (it is a value)

addition


(syntax,type-checking,evaluation)

· Syntax: e1+e2 where e1 and e2 are expressions


· Type-checking: type int but only if e1 and e2 have type int in the same static environment, else does not type-check



· Evaluation: evaluate e1 to v1 and e2 to v2 in the same dynamic environment and then produce the sum of v1 and v2

variables


(syntax,type-checking,evaluation)

· Syntax: a sequence of letters, underscores, etc.


· Type-checking: look up the variable in the current static environment and use that type



· Evaluation: look up the variable in the current dynamic environment and use that value

conditionals


(syntax,type-checking,evaluation)

· Syntax: if e1 then e2 else e3 where e1, e2, and e3 are expressions



· Type-checking: using the current static environment, a conditional type-checks only if (a) e1 has type bool and (b) e2 ande3 have the same type. The type of the whole expression is the type of e2 and e3.



· Evaluation: under the current dynamic environment, evaluate e1. If the result is true, the result of evaluating e2 under the current dynamic environment is the overall result. If the result is false, the result of evaluating e3 under the current dynamic environment is the overall result.





boolean constants


(syntax,type-checking,evaluation)

· Syntax: either true or false


· Type-checking: type bool in any static environment


· Evaluation: to itself in any dynamic environment (it is a value)

less-than comparison


(syntax, type-checking, evaluation)

· Syntax: e1 < e2 where e1 and e2 are expressions


· Type-checking: type bool but only if e1 and e2 have type int in the same static environment, else does not type-check



· Evaluation: evaluate e1 to v1 and e2 to v2 in the same dynamic environment and then produce true if v1 is less thanv2 and false otherwise