![]() |
CSC 4150 Translators and Compilers | Spring 2009 | ![]() |
||||||||
| |||||||||||
| |||||||||||
|
|
| Homework 1: 1.1 Using the context-free grammar of Mini-Triangle on pages 8 and 9 in the textbook, draw syntax trees for the following: a. x * y + z – 3 / 5 b. if x then y else z c. let vasr x: Integer in x := x + y – 3 1.2 Using the grammar specificying the abstract syntax of Mini-Triangle, draw the abstract syntax tree for the following: a. x * y + z – 3 / 5 b. if x then y else z Homework 2: 2.1 Assume that you have the following: a machine M; a C compiler that run on machine M and generates machine code M; and a Java-into-C translator expressed in C. Use tombstone diagrams to represent these language processors. Also show how you would use these language processors to: a. compile and run a program P expressed in C; b. compile the Java-into-C translator into machine code; c. compile and run a program Q expressed in Java. 2.2 The Triangle language processor (see Section 2.7 in textbook) is expressed entirely in Java. Use tombstone diagrams to show how the compiler, interpreter, and disassembler would be made to run on machine M. Assume that a Java-into-M compiler is available. Homework 3: 3.1 The Mini-Triangle source program below would be compiled to the object program listed.
Describe the compilation in the same manner as Examples 3.1, 3.2, 3.4 in the textbook. (You may ignore the generation of the PUSH and POP instructions.) Homework 4: 4.1 Perform syntactic analysis of the Mini-Triangle program: begin while true do putint (1); putint (0) end along the lines of Figures 4.1 through 4.4 in the textbook. 4.2 The micro-English parser (Example 4.11 in textbook) generates some sentences, such as ‘I sees the cat.’, that are ungrammatical in English itself. Modify the grammar to ensure that th esugject agrees with the verb. ‘I’ should agree with ‘like’ or ‘see’, and other subjects should agree with ‘is’ or ‘sees’. Homework 5: Become familiar with the Triangle compiler. Project Description Homework 6: Become familiar with the Triangle compiler. Homework 7: Become familiar with the Triangle compiler. Homework 8: Requirements Analysis Peer Review Report Requirements Analysis Document Weekly Progress Report Homework 9: Weekly Progress Report Homework 10: Technical Specification Document Peer Review Report Technical Specification Document Weekly Progress Report Homework 11: Development Schedule and Plan Test Plan Peer Review Report Test Plan Weekly Progress Report Homework 12: Code Peer Review Report Weekly Progress Report Homework 13: Test Results Report Working System Demonstration Weekly Progress Report Homework 14: Source Code with Documentation User's Manual Peer Review Report User's Manual Weekly Progress Report |
|
|
|
|
| Contact Web Page Owner at lilliec@uncp.edu |