A very crude Java shell. This is a very basic interactive shell that allows one to create instances of classes and to manipulate these instances by calling methods. To simplify the parsing process an extremely simplified format is used for input (which would be tedious in everyday use, but the point of this exercise is not parsing, but reflection): * the shell keeps a map that will associate each variableName with the result of the operation. Such variables will later be available as arguments to other operations (actually, again to simplify matters, this is the ONLY way to supply arguments to operations). can be any of the primitives types ("int", "boolean", ...), "String", "new", "method", or "show". "show" displays a variable's current value. Primitives and "String" assign the appropriate value to a variable. new * instantiates using the appropriate constructor for the supplied parameter values method * calls .methodName(*) and stores the return value (or void) in An example interaction with the shell could be: > java Shell JAVA> a boolean true a = Primitive boolean true JAVA> c new java.lang.Frame Exception while parsing and executing ... java.lang.ClassNotFoundException: java.lang.Frame at java.net.URLClassLoader$1.run(URLClassLoader.java:199) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at Shell.parseCommand(Shell.java:80) at Shell.main(Shell.java:151) JAVA> c new java.awt.Frame c = java.awt.Frame[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=,resizable,normal] JAVA> b int 300 b = Primitive int 300 JAVA> e method c resize b b e = null JAVA> e method c setVisible a e = null JAVA> d boolean false d = Primitive boolean false JAVA> e method c setVisible d e = null JAVA> c show c = java.awt.Frame[frame0,0,0,300x300,hidden,layout=java.awt.BorderLayout,title=,resizable,normal] JAVA> e method c setVisible a e = null JAVA> c show c = java.awt.Frame[frame0,0,0,300x300,layout=java.awt.BorderLayout,title=,resizable,normal]