Mercurial > repos > rhope
annotate compile_old.rhope @ 120:cd25171e1bb2
Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 21 Oct 2010 23:55:15 -0400 |
parents | 25a205094f9b |
children |
rev | line source |
---|---|
114
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 Import parser_old.rhope |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 Main[args] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 { |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 fname <- [args]Index[1] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 { |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 file <- <String@File[~] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 ,text <- [file]Get FString[[file]Length] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 params <- New@Parser[] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 Print[["Parsing "]Append[fname]] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 Null[text, params, New@Parse Program[], 0] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 { |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 Print["Parsing imports"] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 Process Imports[~, params] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 { |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 tree <- [~]Workers << [ Map[[~]Workers >>, ["Check Worker Literals"]Set Input[1, ~]] ] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 { Print["Compiling"] } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 { Print["Compiled program to backend"] } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 outfile <- <String@File[ [fname]Append[".c"] ] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 [outfile]Put String[ [compiled]Text ] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 { Print[["Wrote output to "]Append[ [fname]Append[".c"] ]] } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 }{ |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 REPL[New@Parser[]] |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 } |
25a205094f9b
More performance optimizations
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 |