Programming Assignment 0 - UW CSE 501

Programming Assignment 0 - UW CSE 501 - Programming...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
UW CSE 501 Syllabus Programming Assignment 0 Programming Assignment 1 Programming Assignment 2 Programming Assignment 3 Sitemap Programming Assignment 0 The goal of this project is to write a translator from 3-address format to C. The goals of this assignment are to Make you familiar with compiler intermediate formats, in this particular case, our 3-address format. Write a translator and test its correctness. You will also use this translator to test code transformations in future assignments. Write example C code to test your translator. Project Description We provide 'csc', which compiles a subset of C (CS for C-Subset) to 3-address format. Your will write a translator to convert from this 3-address format back to C. Note that the generated C code will not resemble the original C code. Getting started on Lab 0 (1) Download the c-subset compiler and example C files (see the attachment below) (2) Decompress the file on the cs unix machines using tar xvfz lab0.tgz This command will produce the following directory structure lab0 src examples lab0 The src directory contains the C-subset compiler source file and a make script. The examples directory contains 10 example C files and two bash scripts ( , check- ) for checking your lab0 implementation (see 5 below). To compile the compiler cd src; ./ // your shell should be bash The command will produce an executable file (csc) for the compiler in the src directory. (3) Compile the example c files by using cd . ./examples; . ./src/csc loop.c This command will produce the 3-Address Intermediate Format code to stdout . (4) Implement your own 3-Address to C converter in the lab0 directory. Modify the script to compile your source code if needed. Modify the script to invoke your translator. (5) Verify your implementation. Modify the script examples/ to set the Programming Assignment 0 - UW CSE 501 2/9/2012 11:35 AM You created this PDF from an application that is not licensed to print to novaPDF printer ( )
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
variable THREE_ADDR_TO_C_TRANSLATOR (line5) to your own converter. Then when you invoke command ./ loop.c it will produce several files: loop.3addr //the 3-address format file generated by csc loop.3addr.c //the c file generated by your converter loop.3addr.bin //the binary file generated by gcc compiling loop.3addr.c loop.3addr.txt //the file after executing loop.3addr.bin loop.gcc.bin //the binary file after gcc compiles loop.c loop.gcc.txt //the file after executing loop.gcc.bin If the two .txt files are same, it means your converter (probably) works correctly for this C file. The output message should be: loop.c compiling loop.c loop.c: In function 'main': loop.c:10: warning: return type of 'main' is not 'int' 4a39f3634793c530783afa3ff0b2bd7b loop.gcc.txt 4a39f3634793c530783afa3ff0b2bd7b loop.3addr.txt The last two lines show the md5sum results of the two .txt files. They should be same.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/09/2012 for the course CSE 403 taught by Professor Staff during the Spring '08 term at University of Washington.

Page1 / 8

Programming Assignment 0 - UW CSE 501 - Programming...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online