CSC 4150
UNCP Home Page CSC 4150 Translators and Compilers Spring 2009
Office Information
Instructor: Dr. Charles W. Lillie
Office: 1219 Oxendine
Telephone: 910-521-6415 email: lilliec@uncp.edu
Office Hours: MWF 8:15-8:45, MW 2:30-3:30, F 2:30-4:00
Time: 3:30 to 5:15 Meeting Days: MW Location: Oxendine 1202
Textbook: Programming Language Processors in Java, Authors: David A. Watts & Deryck F. Brown, 2000, Prentice Hall
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.

Source Program
Object Program
Let
PUSH  1
  const m ~ 7;
LOAD 7
  var x: Integer
LOAD 0[SB]
in
CALL mult
  x := m * x
STORE    0[SB]

POP     1

HALT

          
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