pallenec: Don't call everything an "ast"
After the type checker step, it isn't an "ast" anymore.
@@ -11,7 +11,7 @@ p:argument("source_file", "File to compile")
p:flag("--emit-c", "Generate a .c file instead of an .so file")
p:flag("--emit-asm", "Generate a .s file instead of an .so file")
p:flag("--compile-c", "Compile a .c file generated by --emit-c")
-p:option("--dump", "Print the ast from a given compiler pass"):choices(
+p:option("--dump", "Print the result of an internal compiler pass"):choices(
{"parser", "checker", "ir", "uninitialized", "constant_propagation"})
local args = p:parse()
@@ -40,13 +40,12 @@ end
local function compile_internal(filename, stop_after)
local _stop_after = stop_after
if stop_after == "ir" then _stop_after = "to_ir" end
- local prog_ast, errs = driver.compile_internal(filename, _stop_after)
- if not prog_ast then
+ local out, errs = driver.compile_internal(filename, _stop_after)
+ if not out then
util.abort(table.concat(errs, "\n"))
- else
- print(inspect(prog_ast, {process = process_item}))
- util.abort("Exit after generating " .. stop_after .. "'s ast")
end
+ print(inspect(out, {process = process_item}))
+ util.abort(string.format("Exit after %s step", stop_after))
end
local flags = {}
