All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class jie.Shell

java.lang.Object
    |
    +----jie.Shell

public class Shell
extends Object
implements Runnable
Shell for the Java interactive environment. The Shell reads a java statement from the standard input, hands it to the Parser, which returns a token tree. The shell hands the token tree to the Interpreter, which executes the token tree by recursive descent and returns a value. The Shell then reads the next statement, etc.

Version:
0.1
Author:
Michael Robinson (robinson@public.bta.net.cn)
See Also:
Interpreter

Variable Index

 o err
Shell standard error stream.
 o in
Shell standard input stream.
 o out
Shell standard output stream.

Constructor Index

 o Shell()
Create a new Shell instance

Method Index

 o done()
End all interpreter loops for the current instance.
 o labels()
Print a list all labeled token trees on the standard output.
 o main(String[])
Command line entry point.
 o map()
Print a list of all local variables on the standard output.
 o map(String)
Print a string representation of a local variable on the standard output stream.
 o map(String, Object)
Create a new local variable.
 o printTree(AST, String)
Print a string representation of an antlr Abstract Syntax Tree on the standard output stream.
 o read(String)
Read Jie statements from a file.
 o run()
Main interpreter loop.
 o setPrintReturn(boolean)
Enable (disable) return value printing.
 o setPrintTree(boolean)
Enable (disable) token tree printing.

Variables

 o in
public InputStream in
Shell standard input stream.

 o out
public PrintStream out
Shell standard output stream.

 o err
public PrintStream err
Shell standard error stream.

Constructors

 o Shell
public Shell() throws Exception
Create a new Shell instance

Methods

 o main
public static void main(String[] args)
Command line entry point. Usage: java jie.Shell

 o run
public void run()
Main interpreter loop.

 o read
public void read(String file) throws Exception
Read Jie statements from a file. This method can be used to create scripts and initialization files.

Parameters:
file - The path name of a file containing valid Jie statements.
 o map
public void map(String name,
                Object value)
Create a new local variable.

Parameters:
name - The name of the variable.
value - The value of the variable.
 o map
public void map(String name)
Print a string representation of a local variable on the standard output stream.

Parameters:
name - The name of the variable.
 o map
public void map()
Print a list of all local variables on the standard output.

 o labels
public void labels()
Print a list all labeled token trees on the standard output.

 o setPrintTree
public void setPrintTree(boolean b)
Enable (disable) token tree printing. When token tree printing is enabled, Jie will print a string representation of the parsed token tree before the statement is executed. Token tree printing is disabled by default.

Parameters:
b - Set token tree printing to true or false.
 o setPrintReturn
public void setPrintReturn(boolean b)
Enable (disable) return value printing. When return value printing is enabled, Jie will print a string representation of the return value of each statement (which can be an expression, or a simple local variable reference). Return value printing is enabled by default.

Parameters:
b - Set return value printing to true or false.
 o printTree
public void printTree(AST t,
                      String in)
Print a string representation of an antlr Abstract Syntax Tree on the standard output stream.

Parameters:
t - The tree.
in - The "indentation" string. This string will be prepended to each line of the output.
 o done
public void done()
End all interpreter loops for the current instance. This method will end any threads in the run() method of the current instance. Other threads (included those started by this Jie instance) will continue normally.


All Packages  Class Hierarchy  This Package  Previous  Next  Index