This version has been superceded. For the latest version; see Tools index.

JevaES: Java Evaluator --- Expressions & Statements

prerelease version of 1999.02.28
Copyright (c) 1997, 1998, 1999 Massachusetts Institute of Technology.
This software is provided "as is" without express or implied warranty.
Contains parser generated by Sun's JavaCC/JJTree from a modified version of the example Java grammar.
JevaES accepts Java 1.2 source code expressions and statements (but not class declarations) and evaluates (interprets) them. JevaES uses the reflective capabilities included in Java 1.2 (java.lang.reflect) so it can be useful for exploring with and/or debugging an existing compiled system (in case your development environment doesn't provide this capability).

JevaESGUI is a user interface to JevaES. JevaESUI's window contains a scrolling pane of results and a field to type or paste in new expression or statements. A button starts evaluating the field as a Java expression (another just parses the expression); similar buttons do the same for Java statements. JevaESCLI is a command line interface (e.g., for use within a Gnu Emacs command shell, m-x shell).

The results can be examined using a Java Examiner, Jexa, which uses the Java 1.2 reflection capabilities and the JavaBeans introspector to access the public fields and properties of objects and display them in an outline tree for browsing. Objects found through navigation can be used to set the value of Jexa.mousedObject, so that they are accessible for use in method calls.

Applet: If you're viewing this page in a fully Java 1.1 capable browser such as Communicator 4.06, IE 4.01, or HotJava, you should be able to try out a previous version of JevaES and Jexa by pressing the button applet below to start up JevaESUI's window. If your browser does not support Java 1.1, loading the applet will cause an error and no button will appear. (It may take a few minutes to load the files over the network and start the applet.) [On MIT Athena Suns, add javadev, then hotjava.] You can also point the Sun's JDK appletviewer at the URL of this page to run the applet button
(appletviewer http://www.ai.mit.edu/people/caroma/tools/1999-02-28/JevaESUI.html);
appletviewer won't display this surrounding text.

Type or paste expressions or statements in the lower pane; results will appear in the upper pane. Variables declared at top level (not inside a { } block) extend the environment used for evaluating later expressions and statements. You can try complex (or ridiculous) parses like "~1*2+3^4%5|6&7>>>8" and examine the resulting parse tree to see if you understand the precedence order. You can Print to the result pane with:

  import edu.mit.ai.psg.jevaESUI.JevaESUI;
  JevaESUI.out.println("Hello.");
(If used in an application rather than from an applet's security box, JevaESUI redirects System.out to the result pane as well.) Previous results are in: JevaESUI.results.get(n)

Use from programs: JevaESUI can be used to experiment with your own programs. Its read-eval-print-loop (REPL) can be invoked from programs which provide values of variables to inspect or manipulate. A JevaESUI REPL can return values (or throw exceptions) back to programs, so it can be used in a program stub which asks the user to type in code to compute the result. See the JevaES/Jexa Tools documentation for details.

Downloadable Jar files: The current jar files can be downloaded here:

Update Notes --- 1999-02-28: Package statements can be used to change the current package for access to package protected fields and methods. Java1.2 reflection permits access to non-public fields and methods (may require ReflectPermission). Jexa outlines for new Collection, List, Map utilities; BeanOutline restricted to true Java bean properties; ObjectOutline can be used to show non-public fields. Jeva adds interpreted classes, evalhook to JevaES.

Prior version of this page with prior platform notes and prior versons of software (compatible with Java1.1) is available here.

Related Systems:

Bugs to jeva-bugs@ai.mit.edu

 
 

CarlManning

caroma@ai.mit.edu

Back to Tools

This page describes research done at the Artificial Intelligence Laboratory of the Massachusetts Institute of Technology. Support for this research was provided in part by the Advanced Research Projects Agency of the Department of Defense under contracts MDA972-95-1-0018 (North East Regional Consortium Grant) and N66001-95-C-8611 (Computer Aided Education and Training Initiative), and the MIT Department of Electrical Engineering and Computer Science. Support for this research has also been received from IBM, which has generously donated Thinkpad pen computers, and from Microsoft, which has generously donated software.