chap2 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .NH
  2. Outline of the program
  3. .PP
  4. The program can be divided into three parts. A first pass, which
  5. parses C program files and outputs definitions, a second pass which
  6. processes the definitions and a driver,
  7. which feeds the set of files to the first pass and
  8. directs its output to the second pass. Both passes produce the
  9. warnings on standard error output, which are redirected to standard
  10. output by the driver.
  11. .PP
  12. The first pass is based on an existing C front end, called
  13. .I cem
  14. [3].
  15. .I Cem
  16. is part of the Amsterdam Compiler Kit (ACK), as described in [4].
  17. .PP
  18. Most of the code of
  19. .I cem
  20. is left unchanged. This has several reasons. A lot of work, which
  21. is done by
  22. .I cem
  23. , must also be done by
  24. .I lint.
  25. E.g. the lexical analysis, the macro expansions,
  26. the parsing part and the semantical analysis.
  27. Only the code generation part is turned off.
  28. An advantage of this approach is, that a person who understands
  29. .I cem
  30. will not have to spend to much time in understanding
  31. .I lint.
  32. .PP
  33. All changes and extensions to
  34. .I cem
  35. can be turned off by not defining the compiler directive
  36. .ft CW
  37. LINT.
  38. .R
  39. Compiling should then result in the original C compiler.
  40. .PP
  41. The second pass is a much less complex program.
  42. It reads simple definitions generated by the first pass and
  43. checks their consistency.
  44. This second pass gives warnings
  45. about wrong usage of function arguments, their results and
  46. about external variables, which are used and defined in more
  47. than one file.
  48. .PP
  49. The driver is a shell program, to be executed by the
  50. .UX
  51. shell
  52. .I sh.
  53. It executes the two passes and let them communicate through a
  54. filter (sort).
  55. Actually it is simplex communication: the first pass only talks to
  56. the second pass through the filter.
  57. .bp