Compiler.def 1.1 KB

1234567891011121314151617181920212223242526
  1. DEFINITION MODULE Compiler ;
  2. (* TP3 single-pass Pascal -> 8086 compiler, in GNU Modula-2 (-fiso).
  3. Mirrors the original Turbo Pascal 3.0 compiler (TPSRC6 'turbo' entry,
  4. TPSRC7-10): a one-pass parser that reads the shared TextBuf as source
  5. and emits 8086 machine code directly into an internal code buffer, a
  6. patch list resolving forward references, TP3-style error reporting
  7. (error number + relative text position) and code/data size accounting.
  8. The shell (CmdCompile) will call Compile, then jump the editor to
  9. errPos on failure - exactly like the original errexit + editor2 path. *)
  10. PROCEDURE Compile (VAR errNo, errPos : CARDINAL) : BOOLEAN ;
  11. (* Compile the current TextBuf as a Pascal program. Returns TRUE on
  12. success (sizes available via CodeBytes / DataBytes). On failure
  13. returns FALSE, errNo carries the TP3-style error number and errPos
  14. the relative source offset (0-based) for the editor. *)
  15. PROCEDURE CodeBytes () : CARDINAL ;
  16. (* emitted code size in bytes *)
  17. PROCEDURE DataBytes () : CARDINAL ;
  18. (* emitted data size in bytes *)
  19. END Compiler.