edu.mit.ai.psg.jevaESUI
Class JevaESCLI

java.lang.Object
  |
  +--edu.mit.ai.psg.jevaESUI.JevaESCLI

public class JevaESCLI
extends Object

JevaESCLI is a command line (stream) interface for the JevaES Java evalator of expressions & statements. JevaESCLI can be used as

JevaESCLI invokes JevaES, which accepts Java 1.2 EXPRESSIONS or STATEMENTS (plus import and package, but no class declarations nor inner classes). Previous results (including nulls) are stored in a Vector:
.  localResults.get(n) 
Jexa may be invoked programmatically:
.  import edu.mit.ai.psg.jexa.Jexa;
.  Jexa.examine(expression)

See Also:
edu.mit.ai.psg.jevaES, JevaESUI, JevaESGUI, edu.mit.ai.psg.jexa

Field Summary
static String continuePromptFormat
           
static String promptFormat
          Format for the prompt; takes number as single (0th) argument.
static Vector results
          Vector of result values from expressions typed at the window
 
Method Summary
static void main(String[] arguments)
          Application Startup: Loops accepting top level statements and expressions from System.in .
static Object repl()
          Read-Eval-Print-Loop: starts a loop which reads Java expressions and statements from System.in , including return statements to return a value.
static Object repl(int options, String initialMessage, Reader inReader, PrintWriter outWriter, Class returnClass, Class[] throwsClasses, IEnv env, String initStatements)
          Read-Eval-Print-Loop: starts a loop which reads Java expressions and statements from inStream, including return statements to return a value.
static void replTop()
          Top read-eval-print-loop: reads Java expressions and statements from System.in, evaluates them, and prints results of expressions on System.out.
static void replTop(int options, String initStatements)
           
static void replTop(int options, String initialMessage, String initStatements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

results

public static Vector results
Vector of result values from expressions typed at the window

promptFormat

public static String promptFormat
Format for the prompt; takes number as single (0th) argument.
See Also:
MessageFormat

continuePromptFormat

public static String continuePromptFormat
Method Detail

main

public static void main(String[] arguments)
Application Startup: Loops accepting top level statements and expressions from System.in . Options:
-noninteractive don't prompt
-initStatements "statements" run statements before start (e.g., imports)
-message "text" display text after herald
-herald "text" display text in place of herald

replTop

public static void replTop()
Top read-eval-print-loop: reads Java expressions and statements from System.in, evaluates them, and prints results of expressions on System.out.

replTop

public static void replTop(int options,
                           String initStatements)

replTop

public static void replTop(int options,
                           String initialMessage,
                           String initStatements)

repl

public static Object repl()
                   throws Throwable
Read-Eval-Print-Loop: starts a loop which reads Java expressions and statements from System.in , including return statements to return a value.
Throws:
Throwable - --- throws anything user throws.

repl

public static Object repl(int options,
                          String initialMessage,
                          Reader inReader,
                          PrintWriter outWriter,
                          Class returnClass,
                          Class[] throwsClasses,
                          IEnv env,
                          String initStatements)
                   throws Throwable
Read-Eval-Print-Loop: starts a loop which reads Java expressions and statements from inStream, including return statements to return a value.
Parameters:
options - Option flag bits or'ed together; 0 is default. JevaES options used only if env is null.
initialMessage - Non-null text replaces herald; if called from a breakpoint, a good practice is to show user contents of env.
inReader - Reader from which to read Java constructs. If null, uses new InputStreamReader(System.in).
outWriter - Writer to which to write messages, results. If null, uses new PrintWriter(System.out, true).
returnClass - user may only return a value of this class (like method return type); Object.class allows anything. Use void.class for void result. If null, never returns (like a top level loop).
throwsClasses - user may only throw Throwables which are instances of these classes, or instances of Error or RuntimeException (like method throw declarations). If null, defaults to no declarations.
env - initial environment created with JevaES.makeDefaultEnv, JevaES.extendEnv(), or JevaES.parseEval..Statement If null, defaults to JevaES.makeDefaultEnv(options) .
initStatements - initial statements to run. (Convenience feature for extending env from command line or applet parameter, e.g., to specify default imports for user input.) If null, defaults to no statements.
Throws:
Throwable - --- throws anything user throws compatibile with throwsClasses

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu