ack/doc/lint/chap2

58 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

1991-09-30 17:58:00 +00:00
.NH
Outline of the program
.PP
The program can be divided into three parts. A first pass, which
parses C program files and outputs definitions, a second pass which
processes the definitions and a driver,
which feeds the set of files to the first pass and
directs its output to the second pass. Both passes produce the
warnings on standard error output, which are redirected to standard
output by the driver.
.PP
The first pass is based on an existing C front end, called
.I cem
[3].
.I Cem
is part of the Amsterdam Compiler Kit (ACK), as described in [4].
.PP
Most of the code of
.I cem
is left unchanged. This has several reasons. A lot of work, which
is done by
.I cem
, must also be done by
.I lint.
E.g. the lexical analysis, the macro expansions,
the parsing part and the semantical analysis.
Only the code generation part is turned off.
An advantage of this approach is, that a person who understands
.I cem
will not have to spend to much time in understanding
.I lint.
.PP
All changes and extensions to
.I cem
can be turned off by not defining the compiler directive
.ft CW
LINT.
.R
Compiling should then result in the original C compiler.
.PP
The second pass is a much less complex program.
It reads simple definitions generated by the first pass and
checks their consistency.
This second pass gives warnings
about wrong usage of function arguments, their results and
about external variables, which are used and defined in more
than one file.
.PP
The driver is a shell program, to be executed by the
.UX
shell
.I sh.
It executes the two passes and let them communicate through a
filter (sort).
Actually it is simplex communication: the first pass only talks to
the second pass through the filter.
.bp