-

Changes

Jump to: navigation, search

Compiler Structure

1 byte removed, 09:05, 26 July 2017
no edit summary
The compiler is made up of several passes; each pass isimplemented as a separate program. Note that it is notnecessary for the user to invoke each pass individually, asthe C command runs each pass automatically. Note that themachine dependent passes are named differently for each pro-cessorprocessor, for example those with 86 in their name are for the8086 and those with 68K in their name are for the 68000.
The passes are:
CPP :The pre-processor - handles macros and conditional com-pilationcompilation
P1 :The syntax and semantic analysis pass. This writes
intermediate code for the code generator to read.
CGEN, CG86 etc.::The code generator - produces assembler code.
OPTIM, OPT86 etc.
:The code improver - may optionally be omitted, reducingcompilation time at a cost of larger, slower code pro-ducedproduced.
ZAS, AS86 etc.
:The assembler - in fact a general purpose macro assem-
bler.
LINK
:The link editor - links object files with libraries.
OBJTOHEX
:This utility converts the output of LINK into theappropriate executable file format (e.g. .EXE or .PRGor .HEX).
:The passes are invoked in the order given. Each passreads a file and writes a file for its successor to read.Each intermediate file has a particular format; CPP producesC code without the macro definitions and with uses of macrosexpanded; P1 writes a file containing a program in an inter-mediate intermediate code; CGEN translates this to assembly code; AS pro-duces produces object code, a binary format containing code bytesalong with relocation and symbol information. LINK acceptsobject files and libraries of object files and writesanother object file; this may be in absolute form or it maypreserve relocation information and be input to another LINKcommand.
:There are also other utility programs:
LIBR
:Creates and maintains libraries of object modules
CREF
:Produces cross-reference listings of C or assemblerprograms.

Navigation menu