CS 744 Programming Assignment 1 Due May 21, 2003 1. Download the RAG attribute grammar tool and sample applications at: plg/~gvcormac/cs744/rag Create a directory and save rag.tar and ragapp.tar in the directory. Untar the files: tar xvf rag.tar tar xvf ragapp.tar Make the tool and the sample application: make run Test the sample application: ./run < /dev/null 2. Modify the sample application to include an empty statement, denoted by the keyword "skip": stmt -> skip For this and all subsequent parts, generate suitable test examples to demonstrate that your compiler works. 3. Modify the sample application to include an if-then-else statement: stmt -> if test then stmts else stmts fi 4. In some circumstances, the compiler will generate invalid object code; in particular it may try to use more than 26 registers. Fix this problem. 5. Write a program in the source language to do something that requires at least quadratic time in the size of its input. For example, you might want to read N and compute the prime numbers between 1 and N. If you want more of a challenge, solve one of the problems at acm.uva.es/problemset Plot the run time of your program as a function of N. Notes: Uninitialized variables are considered to have the value 0. A failed read statement does not change the target variable. Array assignments are aliasing. That is a := b makes a point to the same storage as b. Array elements may be arrays. An array can contain itself as an element. The runtime system initializes registers and MEM allocations to 0. You should not change the runtime. (i.e. runtime.c)