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 | |
---|
1 | unit UCompiler;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | SysUtils, UAnalyzer, UTarget;
|
---|
7 |
|
---|
8 | type
|
---|
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 |
|
---|
17 | implementation
|
---|
18 |
|
---|
19 | procedure TCompiler.Compile;
|
---|
20 | begin
|
---|
21 | if Assigned(Target) then Target.Produce
|
---|
22 | else raise Exception.Create('Undefined target');
|
---|
23 | WriteLn('Compile');
|
---|
24 | end;
|
---|
25 |
|
---|
26 | procedure TCompiler.RegisterTarget(TargetClass: TTargetClass);
|
---|
27 | begin
|
---|
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];
|
---|
32 | end;
|
---|
33 |
|
---|
34 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.