Return to Snippet

Revision: 46789
at May 25, 2011 03:57 by turbopascalfan


Initial Code
Procedure CompileProgram;
begin
  SourceType := stProgram;
  If CheckAndGetNextToken (Token_PROGRAM) then
    begin
      ExpectIdentifier;
      CreateSymbolTableAndStoreMainModuleNameIdentifier;
      GetNextToken;
      If CheckAndGetNextToken (Token_LeftParenthesis) then
        begin
          Repeat
            ExpectTokenAndGetNext (Token_Identifier);
          until not CheckAndGetNextToken (Token_Comma);
          ExpectTokenAndGetNext (Token_RightParenthesis);
        end;
      ExpectTokenAndGetNext (Token_Semicolon);
    end else begin
               CopyStringToCurrentIdentifier ('PROGRAM');
               CreateSymbolTableAndStoreMainModuleNameIdentifier;
             end;
  SetModuleFlagsAndProcessUsedUnits;
  ProcessDeclarations;
  ProcessMainProgramBlock;
  CheckForPeriodAndModuleEnd;
  ImportObjectFiles;
  CheckForUndefined_FORWARD_Or_EXTERNAL (Ptr (SymbolTable [stProcedures].Segment, SizeOf (TProceduresBlockRecord)));
  JoinSymbolTablesAndCreateUnit;
  CopySegmentsOfSymbolTablesToUnitHeader;
end;

Initial URL
http://turbopascal.org/

Initial Description
This is how Turbo Pascal works.

Initial Title
Turbo Pascal Compiler

Initial Tags


Initial Language
Pascal