Mercurial > repos > rhope
view compile_old_c.rhope @ 127:50406500334d
Port availability of type names at runtime to compiled compiler
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 05 Nov 2010 02:40:51 +0000 |
parents | 25a205094f9b |
children | 18a4403fe576 |
line wrap: on
line source
Import parser_old_c.rhope Main[args] { fname <- [args]Index[1] { file <- [File[~]]Open["r"] text <- String[[file]Read[[file]Length]] params <- Parser[] Print[["Parsing "]Append[fname]] Null[text, params, Parse Program[], 0] { Print["Parsing imports"] Process Imports[~, params] { tree <- [~]Workers << [ Map[[~]Workers >>, Check Worker Literals[?, ~]] ] { Print["Compiling"] } } compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]] { Print["Compiled program to backend"] } outfile <- [File[ [fname]Append[".c"] ]]Truncate [[compiled]Text]Write to File[outfile] { Print[["Wrote output to "]Append[ [fname]Append[".c"] ]] } } }{ Print["You must provide a file name to compile"] } }