![]() | ![]() | ![]() | Testing the Compiler's Output |
To make it easy to process Co programs with your compiler, I will
provide a short shell script named cdimc
(along with lots of other
new odds and ends in the shared/434/Cdim/phase2.3
sub-directory). This
script assumes your executable is named Cdim
(as it will be
unless you have changed the Makefile I provided). The cdimc
script will expect the name of a Co source file as input. To make
things look right, the source file's name should end with a .c
suffix. The script will run the .c
file through your compiler
and then take what your compiler wrote to standard output and provide
it as input to the 34000 assembler. To make it possible to use
#include
directives in the assembly code you output (I'll explain
why you will need this ability later), the
cdimc
script will run your compiler's output through the C
pre-processor, cpp
, before sending it to the assembler.
The "final" output of this process will be a tmem
file, which
will be read as input by the wc34000
interpreter program (or the
mice
interpreter if you decide to trust someone's microcode more
than my interpreter). In addition, the script will leave the actual
output of your compiler in a file whose name is obtained from the name
of the input file by replacing the .c
suffix with a .s
suffix. Similarly, the output listing produced by the assembler will
be stored in a file ending with a .l
suffix (this file is actually
more useful than the .s
file because it shows in which word of
memory each line of code is stored).
To enable you to keep your output code separate from error messages and diagnostics, I have written my code so that all output produced by printree, printdecldesc and DumpDecldescs is directed to "stderr". In addition, in case you want to keep the output that goes to standard output and standard error together, my routines start each line of output they produce with a ";". This will cause the assembler to treat such lines as comments.
![]() | ![]() | ![]() | Testing the Compiler's Output |