CSC 526 - Compiler Design II, Old
Main 136, Wed 6-8:50 PM.
Dr. Dale E. Parson
Spring 2012 Office Hours:
Tu 2:30-4, W 3:45-5:45, Th 1:30-3, and by appointment.
First
day
handout (syllabus that is specific to this semester).
Lecture notes
Assignments
Assignment 1 on adding code generator
support for vectors and run-time library support for memory management
is due by the end of Thursday,
February 23.
The documentation
for
the
original
C++-based
VM is here.
Assignment 2
on adding O1 and O2 optimizations is due by the end of Tuesday, March 13 (updated from
March
10).
Assignment
3
on porting assignment 2's code generator to a Java-based VM is
tentatively due by the end of Sunday,
April 8.
Assignment 4
on generating code for parallel reduce
and collect constructs is due
by
the end of Wednesday, April 25
(changed from Sunday,
April 22).
Assignment 5
on O1 optimization for constant
subexpression folding and elimination of run-time constant variables is
due by
the end of Friday, May 11.
Links to useful course materials.
The Dragon Book website
for the textbook that we are using.
The Python website is at http://www.python.org/.
Documentation is at http://docs.python.org/.
There is a good on-line tutorial and reference by Steven F. Lott called
Building Skills in Python. There is a PDF copy here.
We will be using the 2.6 or 2.7 version of
Python, not 3.x.
Python on bill is at /opt/csw/bin/python.
Python
supplement
on
regular
expressions
and
parser
generators from Spring 2010 Programming Languages course.
http://www.gnu.org/software/make/manual/
has
the
gmake
manual.
Make sure to use either the 16-bit or 32-bit download tools for Python,
Java and Eclipse consistently in the following steps. I have used
32-bit tools for the first time with Windows 7 this semester, with no
particular problems. Do not mix and match 16-bit and 32-bit versions of
Python, Java and Eclipse during installation.
Download site for Python,
use latest stable 2.7.n (or later 2.x.n) version, not 3.x!
After installing Python 2.7 (default
installation is under C:\Python27), go to Windows
Control Panel -> System -> Advanced -> Environment Variables
and set system variable
PYTHONPATH to your Compiler1/ directory. This latter
instructions assumes that all of your course work will go into
subdirectories beneath the Compiler1/ directory. You can decide where
to create Compiler1.
Download site for FileZilla
file transfer utility for transferring files between bill and your PC,
or you can use whatever you already have, for example WinSCP.
Download and install the current Java Development Kit (JDK) before
installing Eclipse.
http://java.sun.com/javase/downloads/index.jsp
has downloads
for JDK 7 (version 1.7) docs and tools
(compiler, etc. for Windows).
Download Java SE Development Kit (JDK)
7 -> Download -> Continue -> Continue,
then click the file, ignoring the "Sun
Download Manager."
After installing JDK 1.7,
go
to
Windows
Control
Panel -> System -> Advanced ->
Environment Variables and set system variable CLASSPATH to your
JavaLang directory. If CLASSPATH is already there, append a semicolon
followed by your JavaLang path to the string that is there.
Download site for
Eclipse IDE/Debugger for Java.
Use the "Eclipse IDE for Java
Developers," then update it as follows.
Download and unzip Eclipse.
Go into the Eclipse directory and run
the eclipse executable file.
Make sure that your Eclipse workspace is in a directory that
is completely different from any of your source code projects. Do not mix Eclipse's meta-data with your
programming projects!
Once Eclipse is running,
click Help -> New Software -> Add site.
Add http://pydev.org/updates as a site,
click the boxes to add packages.
Eclipse should require a restart.
Window -> Preferences -> Pydev
-> Editor -> Interpreter Python for interpreter.
"Auto Config" (or "New") to add Python
2.6 interpreter. If Auto Config does not find Python 2.6, use "New" to
add the path to the Python interpreter, for example
C:\Python26\python.exe if that is where you installed Python. In this
same panel under System PYTHONPATH add your Compiler1 (previously
ProcLang) directory via "New Folder."
(New
step
9/2012) It may be necessary to go to Window -> Preferences ->
PyDev -> Interpreter-PyDev and add the full path to your
Compiler1 directory to the System PYTHONPATH.
Pitfall
#1: After you successfully install and configure PyDev tools
under Eclipse, exit Eclipse and reboot your PC. Problems that I have
encountered may be due to networking problems in Old Main, but I have
had to do this step on two machines after Eclipse went into a hung
state, so you might as well do this after setting up Eclipse and PyDev.
We will go over Pydev Projects, source
editing and debugging in class.
Pitfall
#2: If you remove a Python project such as Compiler1, a) do not
check the box to actually remove the Python files, and b) after
removing the project, exit Eclipse and go into the project directory
with the Windows Explorer and remove files .project and .pydevproject.
Pitfall
#3: Whenever you copy files from bill into a Python project
under Eclipse, make sure to right-click "Refresh" (F5) on your Python
project in Eclipse's "Pydev Package Explorer" panel.
Pydev's home is here.