view compile_old.rhope @ 139:a68e6828d896

Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
author Mike Pavone <pavone@retrodev.com>
date Fri, 19 Nov 2010 04:04:14 -0500
parents 25a205094f9b
children
line wrap: on
line source

Import parser_old.rhope

Main[args]
{
	fname <- [args]Index[1]
	{
		file <- <String@File[~]
		,text <- [file]Get FString[[file]Length]
		params <- New@Parser[]
		Print[["Parsing "]Append[fname]]
		Null[text, params, New@Parse Program[], 0]
		{
			Print["Parsing imports"]
			Process Imports[~, params]
			{
				tree <- [~]Workers << [ Map[[~]Workers >>, ["Check Worker Literals"]Set Input[1, ~]] ]
				{ Print["Compiling"] }
			}
			compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]]
			{ Print["Compiled program to backend"] }
			outfile <- <String@File[ [fname]Append[".c"] ]
			[outfile]Put String[ [compiled]Text ]
			{ Print[["Wrote output to "]Append[ [fname]Append[".c"] ]] }
		}
	}{
		REPL[New@Parser[]]
	}
}