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>
|
BKParser |
Parser for the BK instruction
|
CleanParser |
Parser for the BK instruction
|
ClearScreenParser |
Parser for the ClearScreen instruction
|
DifferenceParser | |
EqualsParser |
Parser for the Equal instruction
|
FDParser |
Parser for the FD instruction
|
GreaterParser |
Parser for the Greater instruction
|
HeadingParser | |
HomeParser |
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
|
LessParser |
Parser for the Less instruction
|
LTParser | |
MinusParser | |
NotEqualsParser |
Parser for the NotEquals instruction
|
PDParser | |
PrintParser |
The parser for the print instruction
|
ProductParser | |
PUParser |
Parser for the Pen Up instruction
|
QuotientParser | |
RemainderParser | |
RepeatParser |
Parse a REPEAT Statement, which looks like
REPEAT numOrVar [ instructionlist ]
|
RTParser | |
SetPCParser |
Parser for the SetPenColor instruction
|
SetPSParser |
Parser for the SetPenSize instruction
|
SetXParser |
Parser for the SetX instruction
|
SetXYParser |
Parser for the SetXY instruction
|
SetYParser |
Parser for the SetX instruction
|
StrictInstructionListParser |
The parser for lists of instructions.
|
SubroutineParser |
Parse an assignment statement, which looks like
<id> <assignment_token, i.e., = > <expression>
|
SumParser |
Parser for the FD instruction
|
ToParser | |
TowardsParser |
Parser for the SetXY instruction
|
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.