Mercurial > repos > rhope
comparison compile_old_c.rhope @ 114:25a205094f9b
More performance optimizations
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 13 Oct 2010 01:15:04 +0000 |
parents | |
children | 18a4403fe576 |
comparison
equal
deleted
inserted
replaced
110:336da6ce8174 | 114:25a205094f9b |
---|---|
1 | |
2 Import parser_old_c.rhope | |
3 | |
4 Main[args] | |
5 { | |
6 fname <- [args]Index[1] | |
7 { | |
8 file <- [File[~]]Open["r"] | |
9 text <- String[[file]Read[[file]Length]] | |
10 params <- Parser[] | |
11 Print[["Parsing "]Append[fname]] | |
12 Null[text, params, Parse Program[], 0] | |
13 { | |
14 Print["Parsing imports"] | |
15 Process Imports[~, params] | |
16 { | |
17 tree <- [~]Workers << [ Map[[~]Workers >>, Check Worker Literals[?, ~]] ] | |
18 { Print["Compiling"] } | |
19 } | |
20 compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]] | |
21 { Print["Compiled program to backend"] } | |
22 outfile <- [File[ [fname]Append[".c"] ]]Truncate | |
23 [[compiled]Text]Write to File[outfile] | |
24 { Print[["Wrote output to "]Append[ [fname]Append[".c"] ]] } | |
25 } | |
26 }{ | |
27 Print["You must provide a file name to compile"] | |
28 } | |
29 } | |
30 |