-
Notifications
You must be signed in to change notification settings - Fork 9
/
GS.Language.Compiler.Pascal.pas
70 lines (52 loc) · 1.2 KB
/
GS.Language.Compiler.Pascal.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
unit GS.Language.Compiler.Pascal;
interface
{$IFDEF FPC}
{$mode delphi}{$H+}
{$ENDIF FPC}
uses
Classes, SysUtils,
//GS.VM,
GS.Language.Parser.Pascal,
GS.Language.Compiler;
type
//...in another unit, link between parser and VM target.
TPascalCompiler = class(TCompiler)
protected
// fProgram : TVMProgram;
// procedure InternalGenerateCode(_prog : TVMProgram);
public
parser : TPascalParser;
function Compile(const _code : String) : boolean; Override;
constructor Create; virtual;
destructor Destroy; override;
// property CompiledProgram : TVMPRogram read FProgram;
end;
implementation
{ TPascalCompiler }
function TPascalCompiler.Compile(const _code: String) : Boolean;
begin
result := parser.Parse(_code);
if result then
begin
// fProgram.reset;
// InternalGenerateCode(fProgram);
end;
end;
constructor TPascalCompiler.Create;
begin
parser := TPascalParser.Create;
// fProgram := TVMProgram.Create;
end;
destructor TPascalCompiler.Destroy;
begin
freeAndNil(parser);
// freeAndNil(fProgram);
inherited;
end;
{
procedure TPascalCompiler.InternalGenerateCode(_prog : TVMProgram);
begin
raise Exception.Create('TODO : EMIT :)');
end;
}
end.