• 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 preceding bindings in the file.

Dynamic Environment

The values of preceding bindings in the file.

Syntax

How to write it.

Semantics

How it type-checks and evaluates.

Type-Check a variable binding

Depends on what kind of expression it is.

Evaluate a variable binding

Use the current dynamic environment.

Value

No way to simplify.

Integer Constant


(Syntax, Type-Checking, Evaluation)

Syntax: sequence of digits.


Type-checking: type INT in any static environment.


Evaluation: to itself in any dynamic environment.

Addition


(Syntax, Type-Checking, Evaluation)

Syntax: e1+e2 where e1 and e2 are expresssions.


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 epxressions.


Type-checking: using current static environment, a conditional 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.


Evaluation: under the current dynamic environment, evaluate e1. If the results 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 results.

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 than v2 and false otherwise.