[pups] lcc (was: GCC)

Jonathan Engdahl jrengdahl at safeaccess.com
Mon Jan 21 12:22:14 AEST 2002

> >>   Consider lcc, the Princeton C compiler. It's much smaller
than gcc,
> >>and ANSI
> >>   compliant.
> >>
> Where can it be found and is it legal to use it on the sorts
of systems
> that we play with?.

About 10 years ago I used version 3 something and wrote a code
generator for a Transputer-like CPU on a chip that we did. I
wrote the author just to clarify, and he said that using their
compiler to generate code for our chip was fair use, as long as
I wasn't selling their code.

I never took a compiler course, but it wasn't that hard to
understand what was going on. I didn't have the book either. I
considered gcc first, but I never did figure it out.

In version three, the front end hands the code generator some
trees, and the code generator walks the trees and spits out
code. For a limited-stack machine similar to the Transputer, it
was easy, except I had to totally redo register allocation.

The front end for version 3 was very good. I recall I only had
to change two or three things in it.

My conclusion is that you have to be a compiler expert to write
a code generator for gcc. Any competent programmer could do it
for lcc.

I think the new version has a code generator generator.

Doing an lcc code generator for the PDP-11 is on my "someday"
list. One thing that you could to do to make it fit on the
PDP-11 is break it up into preprocessor, front-end, and code
generator programs.

Jonathan Engdahl                    Rockwell Automation
Principal Research Engineer         1 Allen-Bradley Drive
Advanced Technology                 Mayfield Heights, OH 44124
http://users.safeaccess.com/engdahl jrengdahl at safeaccess.com

"The things which are seen are temporary,
 but the things which are not seen are eternal."  II Cor. 4:18

More information about the TUHS mailing list