This category contains the main program, common compiler variables, and everything else that does not belong into other categories.

This is the main program of the compiler. It initializes some data, reads configuration file, processes command line parameters, loads library (reports error if it is not found), initializes module data, checks for the main file, resets compilation timer, compiles the source file and writes compilation status.

This procedure processes command line parameters and sets compiler flags and data accordingly.

Compiler should have the possibility to report error from any function. Turbo Pascal solves this problem by defining procedure SetErrorAddress which saves the stack position and return address.

Turbo Pascal reports errors with module name, source line and error position where the error occured. This is very handy to locate the problem. This information can also be used in some text editors to position the cursor where the compiler reported error.

During the compilation Turbo Pascal displays current module and source line number (if command line switch for quiet compilation was not used).

Turbo Pascal has a command line switch /Fseg:ofs which can find module name and source line number compiled at this address. The program is normally compiled but instead of compilation status the source position is displayed.

When no source file is specified this procedure simply displays Turbo Pascal command line syntax with default switch states.

This is where the actual compilation starts. Turbo Pascal first clears and prepares some variables and data structures and then compiles the module (unit or program). If program was compiled then compiler checks for indirect references and calls a procedure to link the code and data and to create the executable file.

Every Turbo Pascal module (program or unit) can use other units. Processing them is one of the trickiest parts of Turbo Pascal compiler.

Each used unit is checked if it is already loaded. If it is not it needs to be found and checked if recompilation is needed

This is the Turbo Pascal System unit. This unit implements Turbo Pascal’s runtime library. When compiling this unit, the compiler automatically includes a boot-strap symbol table (SYSTEM.TPS) which declares all built-in types, procedures, and functions.