CS 603 Project

Spring 2001




Changes to the TinyTalk interpreter

A.     Rewrite the interpreter in Java. You may eliminate the shadow classes, because Java collects garbage automatically.

B.     Remove all the isClassname() methods, and replace all isClassname() messages by dynamic casts.

C.     Replace ReaderClass by a more conventional lexical analyzer and recursive descent parser. Here is the syntax for TinyTalk. [This option is mostly for people who have taken a compilers course.]

D.     Implement self as an implicit instance variable, rather than as a formal parameter, and prohibit assignments to self.

E.      Modify the interpreter to implement Integer as a subclass of Object in the manner it was drawn on the board during class. Also eliminate the references to the global variable intMethods from the IntObject constructors.


Extensions to the TinyTalk language

1.      Add class variables.

2.      Add class methods. [First do the previous option.]

3.      Add access control. Specify public, protected, or private for variables and methods. You will need to provide some syntax for clients to access the variables.

4.      Add public, protected, and private inheritance. [First do the previous option.]

5.      Add method overloading. Resolve overloaded methods based on the number of parameters.

6.      Add variables that are local to methods. Local variables have the same scope as formal parameters, and should be initialized to 0.

7.      Add constructors that can be used to initialize the instance variables.

8.      Add a predefined identifier super, which is the same as self, except that method search begins in the superclass of the class that contains the method that sends a message to super.

9.      Add abstract methods and interfaces.

10.  Add multiple inheritance.

11.  Provide some way to specify that a method will automatically obey refinement semantics, rather than replacement semantics, when it is overridden.

12.  Provide a point-and-click interface that permits browsing through the class hierarchy, and observing the variables and methods of each class.

13.  Provide a way to read and interpret TinyTalk messages stored in textfiles. For example, specify the filenames in the command line, or add the command (read filename).

14.  Provide ways to save and load the current state of the system. For example, add the commands (save filename) and (load filename).

15.  Change the syntax of the assign command from (assign x y) to (x := y).

16.  Change the syntax of the begin command from (begin expr1 expr2 exprN) to {expr1 expr2 exprN}.

17.  Add Smalltalk-like blocks with syntax [expr1 expr2 exprN]. This requires a predefined Block class with a value method.

18.  Add a Boolean class with subclasses True and False, predefined global variables true and false, and methods and, or, not, and if. Remove the method if from the Integer class.

19.  Add Character and String classes with literal representations 'c' and "string" respectively, and methods == and print.

20.  Add classes Number and Float, where Number is a superclass of both Integer and Float. These classes should all have the methods +, -, *, /, ==, <, and >. Integers should be coerced to Floats for the purposes of mixed-mode arithmetic operations.

21.  Add one of the classes Array, List, or Set with an appropriate literal representation and appropriate methods for manipulating the class. For example, an Array literal might look like #(value1 valueN), and a Set could have methods such as insert, delete, and isMember.

22.  Add a Symbol class with literal representation #symbolname and methods ==, print, and value.

23.  Add a class Class with methods classname, superclass, and isSubclass.

24.  Add methods owner, instanceOf, and == to class Object. [First do the previous option.]

25.  Add a metaclass for Object and for each subclass of Object. Each metaclass has only one instance, which represents the class itself. Properly implement the new, subclass, and method methods using metaclasses.

26.  Add a class such as Environment or Method that allows the programmer to examine and use the information contained in the corresponding C++ classes within the interpreter.

27.  Change the syntax for defining methods and passing messages to be more like real Smalltalk. For example, to define a new method, we could use this syntax: (classname method (keyword1: param1 keywordN: paramN) methodbody). Subsequently, to pass a message that invokes this method, we might use this syntax: (receiver keyword1: param1 keywordN: paramN).

28.  Add a command command that permits the programmer to add a new command. For example, (command mycommandname (param1 paramN) body).

29.  Develop a graphical interface that shows the data structure inside the TinyTalk interpreter and how the data structure looks after each command entered, such as was drawn on the board in class.

30.  Add a means to print the data structure maintained inside the TinyTalk interpreter.