1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-13 15:27:28 +00:00
PDP-10.its/doc/c/recipe.cmac
Lars Brinkhoff aec62f3117 Edit SAIL files to be like the originals from ITS.
Rename according to SAIL file C.LIB[C,SYS].  Fix E stuff and remove
trailing ^C and ^@s.
2018-10-30 08:36:56 +01:00

97 lines
4.0 KiB
Plaintext

.fo 0 25vg
.fo 2 25vgi
.sr list_left_margin 0
.sr list_right_margin 0
.so r/r.macros
.tr @
Instructions for transport to PDP10 via CMAC macros.
.sp 2
.fi
The following files are provided:
.ilist 4 0
1. The source of two versions of the C compiler, one that produces
CMAC code and one that produces MIDAS PDP10 code.
.next
2. The source of GT, the program that processes machine
descriptions and produces compiler tables.
.next
3. Two test programs.
.next
4. The compiled CMAC code for the CMAC version of the compiler
and the test program TESTC.
.next
5. A set of MIDAS macro definitions that implement the CMAC
macros on the PDP-10 and a small support package that allows the
TESTC program to run on the ITS operating system.
.next
6. The source of a simple control routine that calls the
compiler phases. This program is provided primarily to show the algorithm.
.next
7. Some of the basic support routines for the ITS PDP-10 implementation.
.next
8. Some documentation. All recipients should first obtain MAC
TR-149 (A Portable Compiler for the Language C -- the major documentation
of the compiler, although slightly obsolete) and Bell Laboratories
Computing Science Technical Report No. 31 (The C Programming Language
-- defines C and a "standard" portable I/O library, which is somewhat
different than the one I use).
.end_list
.ne 10
The following procedure is used to construct a compiler on a PDP10:
.ilist 4 0
1. Modify the provided macro definitions (cmac.insert) and the
support routines (cmac.supprt) for your assembler and operating system.
.next
2. Test the macro definitions and the support routines by
assembling and running the test program TESTC.
.next
3. Implement the small set of I/O routines used by the compiler
(described in ccdoc.text). It is best to keep these as simple as
possible (i.e. don't buffer), as the run-time implementation given for
the CMAC macros is much different than the PDP10 implementation,
so you will have to rewrite them for the PDP10 implementation
eventually.
.next
4. Assemble the CMAC code of the CMAC version of the compiler.
Load the phases together with the I/O routines. Devise some way
of calling the compiler phases in the right sequence and with the
right parameters (use cc.c as guidance). It is not necessary
that this be done by a program.
.next
5. You now have (hopefully) a running C compiler that produces
CMAC object code. Try it out on the test program TESTC and compare
the output with the CMAC file provided.
.next
6. The next step is to construct a compiler that produces PDP-10
code directly. You may wish to bring up the provided PDP-10 version
to see what the output looks like. Assuming that this output is
not satisfactory, decide how it must be changed and make the
appropriate changes to the machine description (pdp10.gt) and the
macro file (c42-10.c). Note that I separate the output into
4 object segments. This kludgery can be ignored; it is necessary only
to support optional things like "compiling" UUOs into PUSHJs and
stack tracing.
.next
7. Compile the GT program using your CMAC compiler.
Assemble and load the GT program and use it to process your new
machine description. Break up the output file into new compiler
source files (use install.teco or the existing files for guidance).
Using your CMAC compiler, compile these new files and assemble them.
Then, load up the new compiler.
.next
8. Test this new compiler on the test program, to see if it
produces reasonable output.
.next
9. Now you must re-implement the I/O stuff for the PDP-10
implementation. You should use the provided support stuff as
guidance, but note that it is far, far more fancy than necessary
and you don't have to even understand all of it. It is best to
start simple (still no buffering); wait until it works before you
try to speed things up and add extra features. You will need
the UUO handler, however (in uuoh.midas).
.next
10. After implementing the I/O stuff for the PDP-10 implementation,
try out the TESTC program. If that works, compile and test the
compiler, itself.
.end_list