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
err- Shell standard error stream.
in- Shell standard input stream.
out- Shell standard output stream.
Shell()
- Create a new Shell instance
done()
- End all interpreter loops for the current instance.
labels()
- Print a list all labeled token trees on the standard output.
main(String[])
- Command line entry point.
map()
- Print a list of all local variables on the standard output.
map(String)
- Print a string representation of a local variable on the standard
output stream.
map(String, Object)
- Create a new local variable.
printTree(AST, String)
- Print a string representation of an
antlr Abstract Syntax Tree on the standard output stream.
read(String)
- Read Jie statements from a file.
run()
- Main interpreter loop.
setPrintReturn(boolean)
- Enable (disable) return value printing.
setPrintTree(boolean)
- Enable (disable) token tree printing.
in
public InputStream in
- Shell standard input stream.
out
public PrintStream out
- Shell standard output stream.
err
public PrintStream err
- Shell standard error stream.
Shell
public Shell() throws Exception
- Create a new Shell instance
main
public static void main(String[] args)
- Command line entry point. Usage:
java jie.Shell
run
public void run()
- Main interpreter loop.
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.
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.
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.
map
public void map()
- Print a list of all local variables on the standard output.
labels
public void labels()
- Print a list all labeled token trees on the standard output.
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.
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.
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.
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