public class SLogoInterpreter
extends java.lang.Object
slogo.expression
,
slogo.instruction
,
InstructionParser
Modifier and Type | Field and Description |
---|---|
private Token |
myToken |
private java.io.StreamTokenizer |
myTokenizer |
Constructor and Description |
---|
SLogoInterpreter() |
Modifier and Type | Method and Description |
---|---|
void |
error(Token t) |
Token |
getToken()
returns the current token, doesn't fetch a new one
|
void |
interpret(java.io.Reader reader,
Context c)
interprets the contents of the Reader: parsing expression(s) and prints
the result of evaluating the expression(s).
|
static void |
main(java.lang.String[] args)
Basic driver for SLogoParser
|
Token |
match(Token rhs)
try to match a token, if unsuccessful throw an exception, otherwise match
succeeds, and next token is obtained and returned
|
Token |
nextToken()
get the next token and store it for retrieval by getToken()
|
private java.io.StreamTokenizer myTokenizer
private Token myToken
public void interpret(java.io.Reader reader, Context c)
reader
- the reader that will be tokenizedpublic Token nextToken()
public Token getToken()
public Token match(Token rhs)
rhs
- token being matchedParseException
- if match failspublic void error(Token t)
t
- token where error occurreda
- ParseException labeled by tpublic static void main(java.lang.String[] args)
args
-