• 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

types of preceding bindings

Dynamic Environment

values of preceding bindings

Syntax

how an expression is written

Value

expression that can't be simplified

Semantics

How its type checked and evaluated

Integer Constants

Syntax: sequence of digits


Type-check: type int in any static environment


Evaluation: to itself in any dynamic environment

Addition

Syntax: e1+e2 where e1 and e2 are expressions


Type-check: type int but inly 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 prodce the sum of v1 and v2

Variables

Syntax: a sequence of letters, underscores, etc.


Type-check: look up the variable in the current environment and use that type


Eval: look up variable in current dynamic env and use that val

Conditionals

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


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


Eval: under dynamic env., evaluate e1. If result is true, the result of evaluating e2 under the dyn. env. is the overall result. If the result is false, the result of eval. e3 under the dynamic environment is the overall result.

Boolean Constants

Syntax: either true or false


Type-Check: type bool in any static environment


Eval: to itself in any dynamic env. (it is a value)

Less than Comparison

Syntax: e1 < e2 where e1 and e2 are expressions


Type-check: type bool but only if e1 and e2 have type int in the same static env. else does not type check


Eval: evaluate e1 to v1 and e2 to v2 in the same dynamic environment and then prod. true if v1 is less than v2, and false otherwise.

Type Check Variable Binding

Current Static Environment

Evaluate a variable binding

Current Dynamic Environment