Part 1: ================================= Extend class dictionary language from MP8 with: optional parts and collection classes (zero or more elements). We call the extended class dictionary language CDS. For the purpose of type checking, we can translate A ~ {B}. into A = B. and also A = [ B]. into A = B. This can be done easily with a preprocessor in DemeterF. Example: Object : Exp | String | Integer. Exp : Lambda | Var. Lambda = String [ Exp] . Var : Sym | Addr. ExpList ~{Exp}. is translated into: Object : Exp | String | Integer. Exp : Lambda | Var. Lambda = String Exp . Var : Sym | Addr. ExpList = Exp . Implement a type checker for CDS. Part 2: ====================================== In mp6 we modified the capacity checking problem: /home/lieber/.www/courses/csg111/f07/machprobs/f07/mp6/capacity Add a repair functionality to the capacity checking problem. This means that a container that is over capacity passes up a list of surplus items that are selected in any way. The enclosing container might have free capacity and can absorb some items on the surplus list. Input: A container C. Output: A container C' with no capacity violations plus a list of surplus items S. C' and S contain the same elements. If the surplus list is not empty for a container then adding any element from the list to the container would bring the container over capacity. (In other words, elements are put on the surplus list only when needed.) Part 3: ================================================= Write a translator using DemeterF that translates the class dictionary language of MP 8 into an equivalent define-datatype expression. The starting point is: /home/lieber/.www/courses/csg111/f07/machprobs/f07/mp8/self-descr The translation should be simple and not attempt to generate the smallest passible define-datatype input. A concrete class B goes into (define-datatype B B? [aB parts]) An abstract class C goes into (define-datatype C C? [a-alt1 (contents alt1?)] ...) as outlined below. Example: PathSpec : Simple | Join | Merge. Simple = Node Node. Join = PathSpec PathSpec . Merge = PathSpec PathSpec . Test = Simple Join Merge. Datatypes: (define-datatype path-spec path-spec? [a-simple (contents simple?)] [a-join (contents join?)] [a-merge (contents merge?)]) (define-datatype simple simple? [simple (source symbol?) (target symbol?)]) (define-datatype join join? [join (first path-spec?) (second path-spec?)]) (define-datatype merge merge? [merge (first path-spec?) (second path-spec?)]) define-datatype test test? [test (simple simple?) (join join?) (merge merge?)]) Use a ToString class similar to the one in http://www.ccs.neu.edu/research/demeter/DemeterF/FuncTest.java because it is a simple linear translation.