edu.mit.ai.psg.jevaUI
Class JevaCLI

java.lang.Object
  |
  +--edu.mit.ai.psg.jevaUI.JevaCLI

public class JevaCLI
extends Object

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

JevaCLI invokes Jeva, which accepts Java 1.2 (except inner and anonymous 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:
JevaGUI, edu.mit.ai.psg.jeva

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 .

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. Jeva 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 or throws (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. If returnClass is not null, then throws are actually thrown; otherwise they are caught and displayed.
env - initial environment created with Jeva.makeDefaultEnv, Jeva.extendEnv(), or Jeva.parseEval..Statement If null, defaults to Jeva.makeDefaultEnv() .
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