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>
|
IdentifierParser |
Parse an assignment statement, which looks like
<id> <assignment_token, i.e., = > <expression>
|
InstructionNames |
Reads the file of instruction names.
|
InstructionParser |
Instruction Parser - calls appropriate Parser for each Instruction
|
PrintParser |
The parser for the print instruction
|
RepeatParser |
Parse a REPEAT Statement, which looks like
REPEAT numOrVar [ instructionlist ]
|
StrictInstructionListParser |
The parser for lists of instructions.
|
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.