public class Forth
extends java.lang.Object
| Constructor and Description |
|---|
Forth()
Initialise the Forth virtual machine.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addArgument(java.lang.String arg)
Add a string to the list of command line arguments passed into
the Forth application.
|
void |
interpret()
Interpret text from the standard terminal device, using the
ForthTerminalReader.
|
void |
interpret(java.io.File file)
Interpret the file as Forth source code.
|
void |
interpret(java.lang.String text)
Interpret a string of text as forth source code.
|
void |
interpret(java.lang.String text,
java.lang.String source)
Interpret a string of text as forth source code from a named
source.
|
void |
interpretFile(java.lang.String filename)
Interpret the given file as Forth source code.
|
void |
setDataStackCells(int size)
Set the maximum number of cells the data data should be able
to hold.
|
void |
setReturnStackCells(int size)
Set the maximum number of cells the return data should be able
to hold.
|
public Forth()
public void interpret()
throws java.io.IOException
ok prompt and await the user input, interpreting
it one line at a time. Errors in the text input are processed
by the interpreter.
Stops the loop and returns when the user executes the
BYE word.java.io.IOException - if there is a problem reading the terminal.public void interpret(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
file - The File object to be interpreted.java.io.FileNotFoundException - When the source file (file) could not be opened.java.io.IOException - When there is a problem reading the file.public void interpret(java.lang.String text)
throws java.io.IOException
text - The string of source code to be interpreted.java.io.IOException - if there is a problem reading the string.public void interpret(java.lang.String text,
java.lang.String source)
throws java.io.IOException
text - The string of Forth source to be interpreted.source - The name of the source input (for error reporting).java.io.IOException - if there is a problem reading the string.public void interpretFile(java.lang.String filename)
throws ForthException,
java.io.FileNotFoundException,
java.io.IOException
filename - The name of the file to be interpreted.ForthException - may be thrown by the force codejava.io.FileNotFoundException - when the file (filename) could not be locatedjava.io.IOException - if there is a difficulty reading the file.public void setDataStackCells(int size)
size - the maximum number of cells the data data should
be able to hold.public void setReturnStackCells(int size)
size - the maximum number of cells the return data should
be able to hold.public void addArgument(java.lang.String arg)
arg - a string argument.