Your job is to extend an interpreter for a simple, dynamically typed Smalltalk-like object-oriented language called miniool. This interpreter is an extension of the interpreter for the simple imperative language with records you have already seen in project 2a. The interpreter skeleton and test cases are available in the course repository.
The language miniool is based on the simple imperative language. It adds the following concepts:
and the following syntactic constructs:
Besides the classes for the various constructs, you are given a visitor Execute for evaluating a statement down to an l-value. Your specific assignment is described in the following. It is suggested that you proceed with each portion of the project in the order given here.
Complete the missing code marked "your job" in execute.scala. Once you have done that, some of the given unit tests should work as expected. Until you complete this part, you will get failures in most of the unit tests!
You must not make any other changes to the given code other than the ones specified below!
Complete the Clazz MyInt in TestMyInt to include the missing methods.
Note that the methods init, itimes, and intValue return an Int, while all other methods (plus, minus, uminus, and times) return a new instance of MyInt.
Furthermore, implement the following expression in the Statement that uses the myInt class in TestMyInt.
Complete the (linearly recursive) fib method in the myInt class in FibonacciTest. Observe that fib(0) = 0, fib(1) = 1, fib(n) = fib(n - 1) + fib(n - 2) where n > 1.
It is not necessary to write any additional scaladoc comments for this project since this project description already serves as documentation for the various components. However, you need to generate the scaladoc. Furthermore, you are required to provide inline comments for your code where appropriate similar to those in Execute case Message.
Please refer to the online submission procedure.