CSE 756 Resources
- Dragon Book, second edition: this is the required text for the course
- ANSI C Specification (n1336.pdf)
- Register Allocation
- Register allocation via graph
coloring, G. Chaitin, M. Auslander, A. Chandra, J. Cocke,
M. Hopkins, and P. Markstein, Journal of Computer Languages, 6:47-57,
1981
- Register allocation & spilling via
graph coloring, G. Chaitin, Proceedings of the
1982 SIGPLAN Symposium on Compiler Construction, June 1982
- Register allocation via graph coloring, P. Briggs, Ph.D. thesis, Rice University, April 1992 (especially Chapter 2)
- JFlex scanner generator
- To use on stdsun or stdlogin: add
/class/cse756/jflex and
/class/cse756/javacup to your classpath. For example, add
setenv CLASSPATH
$CLASSPATH':'/class/cse756/jflex':'/class/cse756/javacup in
your .cshrc file if you are using the tcsh
shell and your CLASSPATH environment variable already has some value.
[NOTE: make sure you are using the default version of Java: run
subscribe from the command line and subscribe for
JDK-CURRENT; log out and log in again.]
- [standalone]
A simple stand-alone scanner is available here. Read the README file. Use the
example to make sure that your JFlex setup works.
- [calc] A more complicated example is available here. This example integrates a scanner, a
parser, and a main driver. Read the README file. Use the example to
make sure that your JFlex+CUP setup works. Details about the example are
available here.
- CUP parser
generator
- To use on stdsun or stdlogin: add
/class/cse756/jflex and
/class/cse756/javacup to your classpath, as described above.
-
ROSE compiler infrastructure
- [getting started] You must be on stdlogin to use
ROSE. Copy Makefile (courtesy of Justin
Holewinski), driver.cpp, and testprog.c to some directory. Run
make. This will compile driver.cpp and will create an
executable mycompiler. Run mycompiler
testprog.c. This will parse the C program in testprog.c and
will generate an AST, using ROSE's frontend. The driver will then
create a file rose_testprog.c which contains pretty printing of the
AST, using a default ROSE backend. Have a look inside Makefile and
driver.cpp — things should be pretty obvious. (Note: if you want
to process a C program that does not have a main
function, run mycompiler -rose:skipfinalCompileStep prog.c)
- [header files] The header files for the ROSE installation
are available at
/class/cse756/rose-0.9.4a/rose/include.
- [source and examples] The source code of ROSE is available
at
/class/cse756/rose-0.9.4a/src. A number of examples of
ROSE translators are available at
/class/cse756/rose-0.9.4a/exampleTranslators. The code
examples used in the ROSE tutorial
are available at /class/cse756/rose-0.9.4a/tutorial.
- [AST understanding] Copy
/class/cse756/rose-0.9.4a/exampleTranslators/PDFGenerator
in your directory, build it, and run it to produce a PDF file with
detailed description and navigation of AST nodes. This is very useful
for understanding the details of the AST representation.
- [AST visualization]
/class/cse756/rose-0.9.4a/exampleTranslators/DOTGenerator
contains two examples of AST visualizers. The output is a 'dot' file
(e.g. testprog.c.dot) which can be used as input to the widely-used graphviz tools (e.g.,
dot and dotty). To use these tools on
stdsun, subscribe to the CONTRIB package. Then you can run, for
example dot -Tgif -otestprog.gif testprog.c.dot to generate
a GIF file with a visualization of the AST. (Ignore the complaints
about missing fonts.) Instead of GIF, you can also use
-Tjpeg, -Tpng, -Tps, -Tsvg, and a number of other formats.