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 | |
BKParser | |
CleanParser |
Parse a CLEAN Statement, which looks like
CLEAN
|
ClearscreenParser |
Parse a Clearscreen Statement, which looks like
Clearscreen
|
CSParser |
Parse a CS Statement, which looks like
CS
|
DifferenceParser | |
EqualParser | |
FDParser | |
ForwardParser | |
GreaterParser | |
HeadingParser | |
HideTurtleParser | |
HomeParser |
Parse a HOME Statement, which looks like
HOME
|
HTParser | |
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 | |
LessParser | |
LTParser | |
MinusParser | |
NotEqualParser | |
PenDownParser | |
PenDownPParser | |
PenUpParser | |
PrintParser |
The parser for the print instruction
|
ProductParser | |
QuotientParser | |
RemainderParser | |
RepeatParser |
Parse a REPEAT Statement, which looks like
REPEAT numOrVar [ instructionlist ]
|
RightParser | |
RTParser | |
SetxParser | |
SetxyParser | |
SetyParser | |
ShowTurtleParser | |
STParser | |
StrictInstructionListParser |
The parser for lists of instructions.
|
SumParser | |
TowardsParser | |
XcorParser |
Parse a XCOR Statement, which looks like
XCOR
|
YcorParser |
Parse a Ycor Statement, which 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.