Here is located the main program, common variables, and everything else that does not belong into other categories.
|
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 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. When used unit needs recompilation the current processed unit (symbol tables and compilar data) need to be pushed to the heap to make room for a new unit.
|
This is the Turbo Pascal System unit. This unit implements Turbo Pascal's runtime library.
|
|
|
|