Parser processes main program and units, checks syntax, processes stream of tokens and generates intermediate code. This is where the core compiler functions are located.

Processing Declarations

This procedure processes Pascal declarations: Constants, Types, Variables, Procedures, Functions, and if declarations are not in the Interface part of an unit also Lables, Constructors and Destructors are processed.

Processing Constant Declarations

Turbo Pascal constants can be of two types: ordinary constants which are only stored to the symbol table and typed constants which are also embedded into the program.

Processing Typed Constants

This procedure processes and stores the value of typed constants. For complex types like Arrays, Records and Objects recursion is used to process elements and fields.

Processing Type Declarations

This procedure processes type declarations. Object types have their own processing.

Processing Non-object Types

This procedure processes all types except Objects and creates type definition records. One one hand objects need different and more complex processing and on the other hand they can not be declared anywhere else as in the program, interface or implementation part.

Processing Object Types

Turbo Pascal includes many functions and procedures to process object type declaration. The reason is in the complexity of object type.

Processing Variable Declarations

This procedure expects a list of identifiers followed by a colon and variable type and processes declaration of variables: global, local and absolute.

Processing Procedure Declarations

Turbo Pascal uses few procedures to process declaration of procedures and functions. The same code is also used to process methods, constructors and destructors.

Processing Label Declarations

Processing Label declarations is trivial. They are simply stored into symbol table as identifiers.

Processing Program Block

This is where main compilation routines are called. This procedure resets many compiler flags and variables, initializes intermediate code, saves source line number, resets compiler switches, and processes statements between begin and end tokes (or asm and end for assembler procedures).

© 2017 Turbo Pascal | Privacy Policy