A PCCTS Tutorial
THIS IS THE PCCTS 1.33 TUTORIAL!
Look Here for the ANTLR 3.x Video Tutorial
Look Here for the ANTLR 2.x Tutorial!
Source Code
Tutorial Examples and HTML
Before starting the tutorial, I just wanted to point out that all the source code for the examples contained within is available via the following links. In addition, the entire HTML source for this tutorial (minus this paragraph as I'm too lazy to re-zip it right now) is also available as a zip.
My Original Compiler Project
Someone sent me a note asking for my original compiler project. I figured "what the heck" and dug it up and sent it to him. Then I figured "what the heck" again and decided to post it here. If you download this and try it and it still works, please let me know!
A few notes on this project's contents:
- The project consisted of
- A compiler, xl, which compiles *.xl files into *.o files
- An interpreter, go, which executes the *.o files
- A disassembler, dis, which disassembles *.o files (extra credit!)
- I have not touched it since the class, and I'm not terribly sure exactly what's there...
- I think I had ok comments in the code -- hopefully it's readable...
- Some of the code is rather wide -- sorry about this, but I set it up to print nicely landscape
- It doesn't exactly match the recognizer built for this tutorial (I started from scratch when doing the tutorial.
- Much of the source code in this zip is the actual PCCTS 1.20 support code (including a simple symbol table.) I think there shoud be everything present here to actually compile and run this, but I haven't tried it in years so I can't guarantee it.
- Keep in mind that I've learned a lot since I took the course, so some things in the course compiler may be weird.
- I used PCCTS 1.20 for the course, and some features like semantic predicates were not quite working right. Therefore I had to do a few things differently than I would had predicates worked properly. (Now 1.33 is available and works well.)
- I wrote the compiler project on an Amiga 2000. (Yup, that's right,
I'm an Amiga fanatic. Unfortunately I had to turn to the dark side
and use a PC for application/speed reasons. A 25MHz Amiga may have
performed as well as a 66MHz PC, but now I've got a 233MHz PII...)
- I used the SAS/C/C++ compiler. The file SCOPTIONS is just a compiler option file
- The makefile should be pretty close to what you'd need on Unix (the Amiga really acted like a unix machine wrt how you run commands and compiling stuff. Using PCCTS was just a matter of changing the compiler name in the PCCTS makefile. Really! It was that easy)
- The test directory contains:
- *.xl files: the sample source files (I think they should be the same as the ones provided in this tut but I haven't checked.)
- ast dir: outputs displaying the ASTs generated from the sources
- dis dir: disassembly outputs
- err dir: compiler messages for each source file
- o dir: compiler-generated object files
Source Code Links
PKZip/WinZip format (.zip)
- base recognizer
- recognizer after cleanup
- sample XL code for testing
- HTML
- my full (original) compiler project
Unix tar, gzipped (.tgz)
- base recognizer
- recognizer after cleanup
- sample XL code for testing
- HTML
- my full (original) compiler project