Semantics

Due: Apr 3, 11:59 PM 
Submit Project: semantics 
Test Files:  fact1.txt if1.txt if2.txt
Results: outfact1.txt outif1.txt outif2.txt

The basic purpose of this assignment is to implement a dynamically typed version of a subset of Gee. In doing so, you should gain a deeper understanding of dynamic typing and of an interpreter.

The state function described in class can be modeled using a Python dictionary (associative array). This dictionary, named state, should be explicitly passed as an argument to each meaning function.

Remember: the meaning of an expression in a state is a value, while the meaning of a statement in a state is a new state.


Your Assignment

  1. Implement the meaning function for all the relationals, and, or for both numbers and Booleans. Remember that the meaning of an expression is always a value. No test case will contain the Boolean constants True, False.
  2. Implement the meaning function for the following Abstract Syntax statements:
    1. Assign.
    2. IfStmt (if-then-else)
    3. WhileStmt.
    4. Block.
    5. StmtList
    Note that an IfStmt begins with the keyword if, a WhileStmt with the keyword while, and an Assign with an identifier (hint: see factor parse).