Here are the files. Note that this directory is just
/net/www/classes/AY2000/cs4240_fall/prj2on the cities machines, in case you just want to issue a "cp" command from your prompt rather than fetch these files from your web browser.
The "minimum requirements" to get an 'A' are effectively to match my output in the outXX files. The out_verboseXX files are mostly so you can get a better understanding of my implementation, and to see how helpful/verbose error message can be. If you want to try to earn extra credit, you can aim for output like the verbose files; mention in the README that you've done something different/extra.
Here's a brief summary of what-all gets printed in the outXX files.
All type mismatches look like this:
Error, line N: type mismatch to operator "OP"even for the non-operators "if" and "while", which expect booleans.
These errors deal with declarations:
Error, line N: Used undeclared variable: "VAR" Error, line N: Duplicate declaration: "VAR" already declared
This one comes from the optimizer:
Error, line N: Division by zero
Here's examples of what you need in your decorated parse tree...
Decorations on variables, showing the type. In your AST, nodes with variables should have references into your symbol table.
x[integer] s[string]
Decorations on operators, showing the types of the operands. In your AST, nodes with operators should know which version of the operator they describe (some operators are overloaded: <[integer] is a different operation than <[string], and you'll want to know this when we reach code generation).
<[integer] :=[boolean]
Constants should be decorated as such:
3[integer][const] "foo"[string][const]
Any node that results from optimization should be labelled as such:
true[boolean][const]<optimized> b[boolean]<optimized>
out01
out02
out03
out04
out05
out06
out07
out08
out09
out10
out11
out12
out13
out14
out_verbose01
out_verbose02
out_verbose03
out_verbose04
out_verbose05
out_verbose06
out_verbose07
out_verbose08
out_verbose09
out_verbose10
out_verbose11
out_verbose12
out_verbose13
out_verbose14
test01
test02
test03
test04
test05
test06
test07
test08
test09
test10
test11
test12
test13
test14