Objectives: Develop the Tokenizer and Parser parts of the
Jack Compiler according to the specification and implementation notes in
chapter 10. The Jack Compiler should compile the jack classes to the virtual machine
defined earlier.
The contract: Write the Jack analyzer program in two stages, as described in chapter 10.
Use it to parse all the .jack files mentioned below. For each source
.jack file, your analyzer should generate an .xml
output file. The generated files should be identical to the supplied .xml
compare-files.
Test programs:
Important note: The tokens list does not appear in a browser, at it is not legal
xml. To fix this, the tokens list should be enclosed within the tags
"<tokens> " and "</tokens> ". For example, the source text "x=5 " should yield the output:
<tokens>
<identifier> x </identifier>
<symbol> = </symbol>
<integerConstant> 5 </integerConstant>
</tokens>
Note however that the <tokens> tags should be used to mark only the tokenizer's output, and should not be used in the output of the final
parser. (This change is introduced simply to enable your browser to render/display the Tokenizer's output properly).
Requirements: You should submit an executable called JackAnalyzer that takes path to a jack
file or directory, and produce an xml file as the result of the parsing of the jack file.
The usage is:
- Single file:
JackAnalyzer path/to/file.jack creates an xml file in
path/to/file.xml
- Directory:
JackAnalyzer path/to/dir parses each of the files in the
directory, and creates the corresponding xml files in the directory.
You should also supply a makefile to compile your code.
Keep your code well organized and documented, as you would in every programming project.
|