source: branches/xpascal/Interpreter.pas

Last change on this file was 225, checked in by chronos, 17 months ago
  • Modified: Project renamed to xpascal.
File size: 771 bytes
Line 
1unit Interpreter;
2
3interface
4
5uses
6 Classes, SysUtils, Parser, Executor;
7
8type
9
10 { TInterpreter }
11
12 TInterpreter = class
13 private
14 Parser: TParser;
15 Executor: TExecutor;
16 public
17 Source: string;
18 procedure Compile;
19 procedure Run;
20 constructor Create;
21 destructor Destroy; override;
22 end;
23
24
25implementation
26
27{ TInterpreter }
28
29procedure TInterpreter.Compile;
30begin
31 Parser.Source := Source;
32 Parser.Parse;
33end;
34
35procedure TInterpreter.Run;
36begin
37 Parser.Source := Source;
38 Parser.Parse;
39 Executor.Prog := Parser.Prog;
40 Executor.Run;
41end;
42
43constructor TInterpreter.Create;
44begin
45 Parser := TParser.Create;
46 Executor := TExecutor.Create;
47end;
48
49destructor TInterpreter.Destroy;
50begin
51 Executor.Free;
52 Parser.Free;
53 inherited;
54end;
55
56end.
57
Note: See TracBrowser for help on using the repository browser.