Posted By

turbopascalfan on 05/25/11


Tagged

pascal compiler Borland Turbo


Versions (?)

Turbo Pascal Compiler


 / Published in: Pascal
 

URL: http://turbopascal.org/

This is how Turbo Pascal works.

  1. Procedure CompileProgram;
  2. begin
  3. SourceType := stProgram;
  4. If CheckAndGetNextToken (Token_PROGRAM) then
  5. begin
  6. ExpectIdentifier;
  7. CreateSymbolTableAndStoreMainModuleNameIdentifier;
  8. GetNextToken;
  9. If CheckAndGetNextToken (Token_LeftParenthesis) then
  10. begin
  11. Repeat
  12. ExpectTokenAndGetNext (Token_Identifier);
  13. until not CheckAndGetNextToken (Token_Comma);
  14. ExpectTokenAndGetNext (Token_RightParenthesis);
  15. end;
  16. ExpectTokenAndGetNext (Token_Semicolon);
  17. end else begin
  18. CopyStringToCurrentIdentifier ('PROGRAM');
  19. CreateSymbolTableAndStoreMainModuleNameIdentifier;
  20. end;
  21. SetModuleFlagsAndProcessUsedUnits;
  22. ProcessDeclarations;
  23. ProcessMainProgramBlock;
  24. CheckForPeriodAndModuleEnd;
  25. ImportObjectFiles;
  26. CheckForUndefined_FORWARD_Or_EXTERNAL (Ptr (SymbolTable [stProcedures].Segment, SizeOf (TProceduresBlockRecord)));
  27. JoinSymbolTablesAndCreateUnit;
  28. CopySegmentsOfSymbolTablesToUnitHeader;
  29. end;

Report this snippet  

You need to login to post a comment.