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>
|
BackwardParser |
Parse a BACKWARD Statement, which looks like
BACKWARD dist
|
BKParser |
Parse a BACKWARD Statement, which looks like
BACKWARD dist
|
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 |
Parse a DIFFERENCE Statement, which looks like
DIFFERENCE num1 num2
|
FDParser |
Parse a FORWARD Statement, which looks like
FORWARD dist
|
ForwardParser |
Parse a FORWARD Statement, which looks like
FORWARD dist
|
HeadingParser |
Parse an Heading Statement, which looks like
HEADING
|
HideTurtleParser |
Parse a HIDETURTLE Statement, which looks like
HIDETURTLE
|
HomeParser |
Parse a Home Statement, which looks like
Home
|
HTParser |
Parse a HT Statement, which looks like
HT
|
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
|
IsEqualParser |
Parse an IsEqual Statement, which looks like
EQUAL num1 num2
|
IsGreaterParser |
Parse an ISGREATER Statement, which looks like
ISGREATER num1 num2
|
IsLessParser |
Parse an IsLess Statement, which looks like
ISLESS num1 num2
|
IsNotEqualParser |
Parse an IsNotEqual Statement, which looks like
NOTEQUAL num1 num2
|
LeftParser |
Parse a Left Statement, which looks like
Left dist
|
LTParser |
Parse a Left Statement, which looks like
Left dist
|
MinusParser |
Parse a MINUS Statement, which looks like
MINUS num
|
PenDownParser |
Parse a PENDOWN Statement, which looks like
PENDOWN
|
PenDownPParser |
Parse a PENDOWNP Statement, which looks like
PENDOWNP
|
PenUpParser |
Parse a PENUP Statement, which looks like
PENUP
|
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 |
Parse a REMAINDER Statement, which looks like
REMAINDER num1 num2
|
RepeatParser |
Parse a REPEAT Statement, which looks like
REPEAT numOrVar [ instructionlist ]
|
RightParser |
Parse a RIGHT Statement, which looks like
RIGHT dist
|
RTParser |
Parse a RIGHT Statement, which looks like
RIGHT dist
|
SetxParser |
Parse a Setx Statement, which looks like
Towards xcor
|
SetxyParser |
Parse a Setxy Statement, which looks like
Towards xcor ycor
|
SetyParser |
Parse a Sety Statement, which looks like
Towards ycor
|
ShowTurtleParser |
Parse a SHOWTURTLE Statement, which looks like
SHOWTURTLE
|
STParser |
Parse a ST Statement, which looks like
ST
|
StrictInstructionListParser |
The parser for lists of instructions.
|
SumParser |
Parse a SUM Statement, which looks like
SUM num1 num2
|
TokenNames |
Reads the file of instruction names.
|
ToParser |
Parse a TO Statement, which looks like
TO sub_name [ instructionlist ]
|
TowardsParser |
Parse a Towards Statement, which looks like
Towards xcor ycor
|
XCorParser |
Parse an XCor Statement, which looks like
XCOR
|
YCorParser |
Parse an 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.