On 20 July 2018 at 11:04, Paul Ruizendaal <pnr(a)planet.nl> wrote:
I will try to
port the C compiler to amd64 - while preserving as much of
the original code as I can. But not sure if this is even feasible.
If that is your goal, you might want to start with the version included with 2.11BSD. It
is essentially the same as the version from V7, but with 15 more years of bug fixes. I
used that source to port V6 Unix to the TI990 architecture back in 2014/2015 and the good
thing about it is that it still compiles with a modern gcc.
I found similarities between the 2.11BSD and 10th edition sources -
presumably 2.11BSD was based on (or incorporated) changes in the 10th
BTW did you publish your work?
For your project, I think you would be able to use the
first pass ‘c0’ almost unchanged.
I have been able to get c0 working. I had to work around the use of
sbrk() as this is not supported on Windows. I also changed the output
to text format - mainly so that I can see what is being generated.
The second pass ‘c1’ would need major restructuring.
It mainly builds a tree for each expression and then performs various transformations,
many of which are PDP11 specific (but also portable ones, like handling of constant
expressions). It then covers the tree with code fragments selected from a library. This
library (‘optable') would need a full rewrite as well.
This part will be more difficult I suspect - but I will only start on
this after I have converted c0 to output 64-bit compliant intermediate
It seems that Dennis Ritchie wrote a paper 'A Tour through the Unix C
Compiler' which is quite useful in understanding the compiler. I have
converted the doc to Markdown format as well which makes it easier to
Thanks and Regards