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 |
The parser for the BACK instruction.
|
CharTokenParser | |
CleanParser | |
ClearScreenParser | |
DifferenceParser | |
EqualParser | |
ForwardParser |
The parser for the forward instruction
|
GreaterParser | |
HeadingParser | |
HideTurtleParser |
The parser for the HIDETURTLE instruction
|
HomeParser |
The parser for the HOME instruction.
|
IdentifierParser |
Parse an assignment statement, which looks like
<id> <assignment_token, i.e., = > <expression>
|
IfParser | |
InstructionNames |
Reads the file of instruction names.
|
InstructionParser |
Instruction Parser - calls appropriate Parser for each Instruction
|
LeftParser |
The parser for the LEFT instruction.
|
LessParser | |
MinusParser | |
NotEqualParser | |
PenDownParser | |
PenDownPParser | |
PenUpParser | |
PrintParser |
The parser for the print instruction
|
QuotientParser | |
RemainderParser | |
RepeatParser |
Parse a REPEAT Statement, which looks like
REPEAT numOrVar [ instructionlist ]
|
RightParser |
The parser for the RIGHT instruction.
|
SetXParser | |
SetXYParser |
The parser for the SETXY instruction
|
SetYParser | |
ShowTurtleParser |
The parser for the SHOWTURTLE instruction
|
StrictInstructionListParser |
The parser for lists of instructions.
|
SumParser | |
TowardsParser | |
XCorParser | |
YCorParser |
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.