-
Notifications
You must be signed in to change notification settings - Fork 13
/
run.ts
34 lines (28 loc) · 1.05 KB
/
run.ts
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
import { FileIO } from './src/IO/FileIO';
import { ConsoleOutput } from './src/IO/Output/ConsoleOutput';
import { LexicalAnalyzer } from './src/LexicalAnalyzer/LexicalAnalyzer';
import { SyntaxAnalyzer } from './src/SyntaxAnalyzer/SyntaxAnalyzer';
import { Engine } from './src/Semantics/Engine';
import { RuntimeError } from './src/Errors/RuntimeError';
import { config } from './src/PascalJs/demoConfig';
type my = 'test';
var fileIO = new FileIO('example.pas', new ConsoleOutput());
var lexicalAnalyzer = new LexicalAnalyzer(fileIO);
var symbol = null;
//for (i= 1; i<= 200; i++) {
// symbol = lexicalAnalyzer.nextSym();
// console.log(symbol);
//}
var syntaxAnalyzer = new SyntaxAnalyzer(lexicalAnalyzer);
try {
var tree = syntaxAnalyzer.analyze();
// console.dir(tree, { depth: null });
var engine = new Engine(tree, config);
engine.run();
// console.dir(engine.scopes, { depth: null });
// console.dir(engine.scopes[0].items, { depth: null });
} catch (e) {
if (e instanceof RuntimeError) {
fileIO.printListing(e);
}
}