|
1 |
|
2 module('lgen', package.seeall) |
|
3 -- export src dst hierarchy |
|
4 |
|
5 require('scan') |
|
6 require('handlers') |
|
7 |
|
8 -- |
|
9 -- Main |
|
10 -- |
|
11 |
|
12 if #arg < 2 then |
|
13 error("Usage: lgen src dst") |
|
14 end |
|
15 |
|
16 src = arg[1] |
|
17 dst = arg[2] |
|
18 |
|
19 print('Scan...') |
|
20 hierarchy = scan.scan(src) |
|
21 |
|
22 -- Pitäisi env konstruoida. polun perusteella. |
|
23 scan.map(hierarchy, function(f) handlers.choose(f, env) end) |
|
24 |
|
25 print('Phase 1...') |
|
26 scan.map(hierarchy, function(f) handlers.phase1(f, env) end) |
|
27 print('Phase 2...') |
|
28 scan.map(hierarchy, function(f) handlers.phase2(f, env) end) |
|
29 print('Phase 3...') |
|
30 scan.map(hierarchy, function(f) handlers.phase3(f, env) end) |