CSE 5343 Resources
[standalone] A simple stand-alone scanner is available
- 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. Running
java -version on
stdlinux should give you
1.8.0_171 (current as of August 14, 2018).
/class/cse5343/javacup to your classpath.
echo $0 to determine which shell you are using.
if you are using the
.cshrc file (if your CLASSPATH environment variable already has some value).
If CLASSPATH is not set up at all, add
setenv CLASSPATH .':'/class/cse5343/jflex':'/class/cse5343/javacup. In both cases, the current directory will be added to your classpath, together with the
stdlinux and do
standalone.tar.gz. Then read the README file. Use the example
to make sure that your JFlex setup works.
ROSE compiler infrastructure
- To use on
/class/cse5343/javacup to your classpath, as described above.
- [calc] A simple example is available here. This example integrates a scanner, a
parser, and a main driver. Details are available here.
Research paper 1 and
research paper 2 with interesting examples of compiler bugs
Research paper illustrating some of the difficulties in analysis of binary code
Research paper discussing the subtle issues with integer overflows in C/C++
Research paper on a simple but effective approach for register allocation
- [getting started] Use ROSE on
stdlinux (note: this is an older version, different from the one on the ROSE web page).
TestMakefile (courtesy of Justin
testprog.c to some directory. Run
make -f TestMakefile. This will compile
and will create an
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
driver.cpp — things should be pretty obvious. If you want
to process a C program that does not have a
./mycompiler -rose:skipfinalCompileStep file1.c file2.c file3.c ...
- [AST understanding] Copy
in your directory. Change
TestMakefile to use
pdfGenerator.C instead of
Build it and run it to produce a PDF file with
detailed description and navigation of AST nodes. You can navigate the nodes in the PDF file by using the PDF bookmarks. Run this generator on a few simple C programs and examine the AST nodes. This can be very useful
for understanding the details of the AST representation.
- [AST visualization]
contains two examples of AST visualizers.
is the simpler version and
a more complex version that provides more details.
TestMakefile to use the version you want.
Both generate as
output a 'dot' file (e.g.
testprog.c.dot) which can be
used as input to the widely-used Graphviz tools (e.g.,
dot). The Graphviz software is installed on
stdlinux. You can run
dot -T jpeg -o
testprog.jpeg testprog.c.dot to generate a JPEG file with a
visualization of the AST. You can also use
-T pdf, and a number of other formats.