Turbo Pascal Compiler


/ Published in: Pascal
Save to your folder(s)

This is how Turbo Pascal works.


Copy this code and paste it in your HTML
  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;

URL: http://turbopascal.org/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.