| Interface | Description |
|---|---|
| Parser |
The interface that all parsers must implement
|
| Class | Description |
|---|---|
| AssignmentParser |
Parse an assignment statement, which looks like
<id> <assignment_token, i.e., = > <expression>
|
| BackParser |
Parse a BK Statement, which can look like either
BACK dist
or
BK dist
|
| CleanParser |
Parse a CLEAN Statement, which simply looks like CLEAN
|
| ClearScreenParser |
Parse a CLEARSCREEN Statement, which can look like either
CLEARSCREEN
or
CS
|
| DifferenceParser |
Parse a DIFFERENCE Statement, which looks like
DIFFERENCE num1 num2
|
| EqualBoolParser |
Parse a EQUAL? Statement, which looks like
EQUAL? thing1 thing2
|
| ForwardParser |
Parse an FD Statement, which can look like either
FORWARD dist
or
FD dist
|
| GreaterParser |
Parse an GREATER? Statement, which looks like
GREATER? num1 num2
|
| HeadingParser |
Parse a HEADING Statement, which simply looks like HEADING
|
| HideTurtleParser |
Parse a HT Statement, which can look like either
HIDETURTLE or HT
|
| HomeParser |
Parse a HOME Statement, which simply looks like HOME
|
| IdentifierParser |
Parse an assignment statement, which looks like
<id> <assignment_token, i.e., = > <expression>
|
| IfParser |
Parse an IF Statement, which looks like
IF varOrCommand [ instructionlist ]
|
| InstructionNames |
Reads the file of instruction names.
|
| InstructionParser |
Instruction Parser - calls appropriate Parser for each Instruction
|
| LeftParser |
Parse a LT Statement, which can look like either
LEFT degrees
or
LT degrees
|
| LessParser |
Parse a LESS? statement, which looks like
LESS? num1 num2
|
| MinusParser |
Parse a MINUS statement, which looks like
MINUS num
|
| NotEqualParser |
Parse a NOTEQUAL? Statement, which looks like
NOTEQUAL? thing1 thing2
|
| PenDownParser |
Parse a PENDOWN? Statement, which can look either like
PENDOWN
or
PD
|
| PenDownPParser |
Parse a PENDOWNP Statement, which can look like either
PENDOWNP
or
PENDOWN?
|
| PenUpParser |
Parse a PENUP Statement, which can look either like
PENUP
or
PU
|
| PrintParser |
The parser for the print instruction
|
| ProductParser |
Parse a PRODUCT Statement, which looks like
PRODUCT num1 num2
|
| QuotientParser |
Parse a QUOTIENT Statement, which looks like
QUOTIENT num1 num2
|
| RemainderParser |
Parses a REMAINDER statement, which looks like
REMAINDER num1 num2
|
| RepeatParser |
Parse a REPEAT Statement, which looks like
REPEAT numOrVar [ instructionlist ]
|
| RightParser |
Parse a RT Statement, which can look like either
RIGHT degrees
or
RT degrres
|
| SetXParser |
Parses a SETX command, which looks like
SETX xcor
|
| SetXYParser |
Parses a SETY command, which looks like
SETXY xcor ycor
|
| SetYParser |
Parses a SETY command, which looks like
SETY ycor
|
| ShowTurtleParser |
Parses an ST command, which can look like either
SHOWTURTLE
or
ST
|
| StrictInstructionListParser |
The parser for lists of instructions.
|
| SumParser |
Parses a SUM parser, which looks like
SUM num1 num2
|
| ToParser |
Parse a TO Statement, which looks like
TO sub_name [instructionlist]
|
| TowardsParser |
Parses a TOWARDS statement, which looks like
TOWARDS xcor ycor
|
| XcorParser |
Parse an XCOR Statement, which simply looks like
XCOR
|
| YcorParser |
Parse a YCOR Statement, which simply looks like
YCOR
|
| Exception | Description |
|---|---|
| ParseException |
A specialized exception class for parsing errors.
|
This package is responsible for parsing the language SLogo. It uses recursive descent with, currently, no lookahead.
To parse a new instruction the following steps are followed. We'll use
the addition of an
If
instruction to the language as an example.
token.ReservedToken) with the same
prefix as the new instruction, e.g., IfToken.java.
IfParser.java. The parsing class
(presumably implementing Parser) will
return an instance of the parsed Instruction, see the next item.
If.java
in the slogo.instruction package.
instructions.prop,
e.g., add a single line to the file containing the string If.