source: branches/dcomp/Compiler/UCompiler.pas

Last change on this file was 91, checked in by chronos, 8 years ago
  • Added: Start new compiler branch which should run under Delphi. Logical parts should be maintained separately.
File size: 682 bytes
Line 
1unit UCompiler;
2
3interface
4
5uses
6 SysUtils, UAnalyzer, UTarget;
7
8type
9 TCompiler = class
10 Targets: array of TTarget;
11 Analyzer: TAnalyzer;
12 Target: TTarget;
13 procedure Compile;
14 procedure RegisterTarget(TargetClass: TTargetClass);
15 end;
16
17implementation
18
19procedure TCompiler.Compile;
20begin
21 if Assigned(Target) then Target.Produce
22 else raise Exception.Create('Undefined target');
23 WriteLn('Compile');
24end;
25
26procedure TCompiler.RegisterTarget(TargetClass: TTargetClass);
27begin
28 SetLength(Targets, Length(Targets) + 1);
29 Targets[Length(Targets) - 1] := TargetClass.Create;
30 if not Assigned(Target) then
31 Target := Targets[Length(Targets) - 1];
32end;
33
34end.
Note: See TracBrowser for help on using the repository browser.