Implement additional Dream features in your compiler (see below for the grading requirements).
Write a technical manual.
Your compiler must continue to support the same command line options and overall behavior as in Phase 4.
Your compiler must perform semantic error checking on all features it supports. For example, if your compiler supports multiple classes, it must perform semantic checking related to instantiating classes and calling their methods, but if it does not support multiple classes, then that semantic checking is not necessary.
See the Dream semantic specifications.
See manual for details.
The final deliverable grade will be determined by
The compiler must handle basic programs which include the following features. (Features marked with an asterisk (*) are absolutely required in order for you to pass the class, and would yield a maximum phase 5 grade of 70%.)
*Instance variable declarations (types int and boolean only) without initializer expressions
*Expressions: literals, ID’s, parenthesized expressions
*Assignment statement
*If-Then-Else statement
*Call statement
*Output of integer data using out.writeln(x)
*Loop While statement
Method declarations with arguments and an optional return type (no string support required)
Method calls
Recursion support (use of stack-based activation records)
Input of integer data using x := in.readint( )
In addition to processing C version programs, the compiler must
handle multiple user-defined classes (no inheritance)
The last class defined must contain a start( ) method. If multiple source files appear on the command line, the last class defined in the last file must contain a start( ) method. The _main code generated by the compiler should construct a new instance of the last class defined and invoke its start( ) method. It is not an error if more than one class contains a start( ) method.
dynamically allocate memory for instance variables
handle all expressions, including object instantiation, null, and the built-in me identifier
generate code to perform run-time null pointer exception checks
support programs that use the string type
Note: You don’t need to implement the relational operators for strings, or the string concatenation operator. If you choose to implement them, do so by invoking the appropriate methods in the String class.
In this version, your compiler should automatically include the provided Dream standard library (you can get it from /examples/codegen/Dreamstdlib). The compiler should look for a file named stdlib.Dream in the current working directory and implicitly load it as the first file to be processed, without the user’s having to specify it on the command line.
Add support for Dream programs that use inheritance.
For full credit, you must support polymorphism and perform run-time type checking on assignment statements and parameters in method calls.
Implement garbage collection. I suggest a reference counting solution. Prove that it works by printing out the the number of bytes of allocated storage when your program exits (should be 0).
Some extra credit is available for basic reference counting that works for programs that don’t use any objects containing references to other objects (programs without Strings)
More extra credit is available for full reference counting (programs with Strings and other objects that contain references to objects)
An alternative approach would be to implement garbage collection using a library such as the Boehm garbage collector:
http://www.hboehm.info/gc/
Boehm Garbage Collector Home page
http://discontinuously.com/2012/02/How-the-Boehm-Garbage-Collector-Works/
Article on how it works (site no longer online; access via wayback machine)
Clone the phase5 folder in the submission system to your computer, copy your miniDream folder into it, and rename the folder to Dream.
Electronic submission is due Thursday, April 18, 11:59 pm. Create README.md in the root of the dream folder with the number of hours you spent on this phase. Indicate the target level (A, B, C), and list any known bugs. Also, include an academic integrity statement indicating what help you received, if any.