A Scheme Interpreter
Part Two: A Datum Parser
Complete the implementation of a Scheme-style S-Expression parser, using the provided Java code. The grammar describing each datum is a subset of the syntax specified in the Revised^6 Report on the Algorithmic Language Scheme, Section 4.3 (Datum Syntax).
The subset only allows for the lexeme datum values specified in
the TokenType
enum, together with some of the list
datum rules, including dotted notation and basic quotes.
Datum ::= LexemeDatum | CompoundDatum LexemeDatum ::= Boolean | Number | Character | String | Symbol Symbol ::= Identifier CompoundDatum ::= List List ::= ( {Datum} ) | [ {Datum} ] | ( [Datum] . Datum ) | [ [Datum] . Datum ] | Abbreviation Abbreviation ::= ' Datum
When the end-of-file is reached, your parser should
return null
.
Details
-
Using the code you started with from Part One (based
on
schemeProjectStarter.zip
), editDatumParser.java
.