[Color Computer] [Coco] PCCTS

Boisy Pitre boisy at boisypitre.com
Wed May 10 15:44:15 EDT 2006

On May 10, 2006, at 11:16 AM, James Diffendaffer wrote:

> We used lex/yacc and we had to compile Pascal.  There was another tool
> you could use if you got down on your hands and knees and worshiped
> the professor but I can't remember what it was.  Fun was not a part of
> that class as the proff was a jerk.  Same guy that made us rewrite
> half the Unix commands from scratch when I took C.  (there was no C++
> class)

I have to say, the professor was great.  He obviously knew the  
material, answered questions and shared the enthusiasm of the entire  

> I can see where it could have been a really fun class though.  Glad
> you enjoyed it Boisy!  Definately a class you don't want to take if
> you are signing up for over 18 credits or have a job.  Completing a
> compiler in a semester or quarter is a significant accomplishment.

Thankfully, we already had some of the tools (rma/rlink) already  
done.  There is a certain beauty to watching a high level language  
being transformed into assembly, I have to admit.  As inefficient as  
the code generator is (and there exists no i-code optimizer yet),  
it's still quite neat.

>> I don't know this PCCTS thing.  Will it run under Linux?

Sure will.  I used my PowerBook G4 to do all of my development on  
this project, and it worked well.  PCCTS stands for Perdue Compiler  
Construction Tool Set, and it has been surpassed by something called  
ANTLR (see http://www.antlr.org/).  However, ANTLR grammar files are  
written in Java, and the professor preferred C++, so that's why we  
used PCCTS.

The link to PCCTS 1.33M is http://www.antlr.org/pccts133.html

> PCCTS looks interesting.
> GCC (at least the 4.x versions) builds and optimizes intermediate code
> in a similar (same?) manner.  It makes targeting different CPUs a lot
> easier.  Just implement the code generator calls and add rules to the
> peephole optimizer.  I've learned quite a bit about modern compiler
> consruction just from what I've done so far but I don't think I'd want
> to write a compiler from scratch ever again.

The thing about GCC is that it takes a lot of resources just to set  
up the compiler and use it.  Also the 6809 code generator doesn't  
generate position independent code, so it would take some work to  
rework the back-end to do just that.

> I'd certainly be interested in taking a look at it since I've never
> used rma and rlink.

I've created a CVS repository for 'bctk' (Boisy's Compiler Took Kit)  
up at www.nitros9.org.  You need PCCTS 1.33M installed, and follow  
the instructions at www.nitros9.org/guidelines.html to get a public  
key to Alan and have him create you an account.

I found a tutorial on PCCTS along with a complete grammar  
specification and language definition at http://www.javadude.com/ 
articles/pcctstut/  The guy there did a great job documenting his work.

> I hope the finals went well for you Boisy.

Thanks James.  Last one's tomorrow.


More information about the Coco mailing list