Compiler Design ---- Final Project ---- Due: 1:00 pm, June 27 (Tuesday) 2013 Extend your homework 5 to include the followings: Required: 1. (25%) More control structures 1.1 (8%) for loop FOR int-var := int-expression-1 TO int-expression-2 DO statement/block FOR int-var := int-expression-1 DOWNTO int-expression-2 DO statement/block 1.2 (7%) while loop WHILE boolean-expression DO statement/block 1.3 (10%) case statement CASE expression OF constant1: statement/block constant2: statement/block ... [optional] OTHERWISE: statement/block ENDCASE; 2. (10%) 2-dimensional arrays ARRAY [0..3,5..6] OF INTEGER: A; ... A[3,5] := 45; 3. (20%) nested block structure variables can be declared at the beginning of any block BEGIN i := i+1; BEGIN VAR REAL: i; ENDVAR i := 1.2; END END 4. (25%) non-nested procedure/function def. after the declaration section of the main program parameters: call by value do not support recursive call's PROGRAM main VAR INTEGER: i,j,k; ENDVAR PROCEDURE f(INTEGER: x,y,z; REAL:h); VAR ... ENDVAR BEGIN %% beginning of f() ... END BEGIN %% beginning of main() ... END INTEGER FUNCTION f(INTEGER:x,y,z; REAL:h); VAR ... ENDVAR BEGIN ... END You must also pick at least 2 items in the following list. 1. (10 %) multi-dimensional array 2. (15 %) call by reference PROCEDURE f(INTEGER:x,y,z; VAR REAL: h); %% h is call by reference 3. (10 %) call by value result PROCEDURE f(INTEGER: x,y,z; RES REAL: h); %% h is call by reference 4. (10%) record: syntax as PASCAL as in the slides 5. (25%) recursive procedure/functional call (static scoping) 6. (15%) pointer data structure: syntax as PASCAL as in the slides 7. (10%) Boolean data type: BOOL: a; 8. (20%) string data type: STRING[15]: b; // a string of 15 characters 9. (10%) character data type: CHAR: i; 10. (35%) dynamic storage allocation (alloc and free) 11.(35%) nested function definition (static scoping) function a() function b() 12.(40%) dynamic scoping 13. (<=15%) various code optimization techniques introduced in class NOTE: 1. see the spec of year 2006 (compiler2006) for details. 2. TA will announce the details of final projects in TA's web page. 3. Need to have documentations in addition to codes. a. implementation details data structures/flow-of-control/algorithm/... b. best/worst parts of your code c. other helpful features d. a section on the optional parts selected 4. Code need to have suitable amount of comments. 5. Need to provide test cases for the optional parts 6. Scoring rules: Required: 80 % Selective: >= 20 % For each part: Correctness: 60%. Documentation: 25%. Elegance: 15%.