X-Git-Url: http://nitlanguage.org diff --git a/src/nit.nit b/src/nit.nit index 196961d..6441b1a 100644 --- a/src/nit.nit +++ b/src/nit.nit @@ -18,7 +18,7 @@ module nit import interpreter -import frontend +import frontend::code_gen import parser_util import vm @@ -64,24 +64,27 @@ if opt_eval.value then modelbuilder.load_rt_module(parent, amodule, "-") mmodules = [amodule.mmodule.as(not null)] +else if progname == "-" then + var content = stdin.read_all + var amodule = toolcontext.parse_module(content) + toolcontext.check_errors + modelbuilder.load_rt_module(null, amodule, "-") + mmodules = [amodule.mmodule.as(not null)] else mmodules = modelbuilder.parse([progname]) end modelbuilder.run_phases +toolcontext.run_global_phases(modelbuilder.parsed_modules) -if toolcontext.opt_only_metamodel.value then exit(0) +if toolcontext.opt_only_metamodel.value then toolcontext.quit var mainmodule = toolcontext.make_main_module(mmodules) var self_mm = mainmodule var self_args = arguments -if toolcontext.opt_debugger_autorun.value then - modelbuilder.run_debugger_autorun(self_mm, self_args) -else if toolcontext.opt_debugger_mode.value then - modelbuilder.run_debugger(self_mm, self_args) -else if opt_vm.value then +if opt_vm.value then modelbuilder.run_virtual_machine(self_mm, self_args) else modelbuilder.run_naive_interpreter(self_mm, self_args)