Due: Apr 10, 11:59pm Submit Project: type Test Files: t2.txt t3.txt t4.txt max.txt maxErr.txt fact.txt factErr.txt Results: t2.out t3.out t4.out max.out maxErr.out fact.out factErr.out
In this project, you are asked to implement a static type checker for Gee language. The type rules of Gee are the same as those of CLite, except for the following:
number
and boolean
types of values. No need to consider string
or other types.You are allowed to develop it based on either your parser developed in the previous project or the paser sent to you by the grader. (The semantic part of the parser is not relevant to this project.)
Use tipe as the name of the type function of each class.
The type map described in class can be modeled using a Python dictionary (associative array). This dictionary, named tm, should be explicitly passed as an argument to each tipe function.
The order in the output does not matter as long as the error message, if there is any, is printed as the final line.
Remember: the tipe function of an expression should not only check the type validity of the expression, but also return the type of the result of the expression.
Hint: Invoke the type checker after the program parsing has finished.