From 0fc978f10c9fc14c6dedc74294e8e557c2c0af9b Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 18 Dec 2014 22:42:00 -0500 Subject: [PATCH] nit: new experimental `--vm` option to run the vm Signed-off-by: Jean Privat --- src/nit.nit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nit.nit b/src/nit.nit index 5e8697d..5a74d48 100644 --- a/src/nit.nit +++ b/src/nit.nit @@ -20,6 +20,7 @@ module nit import interpreter import frontend import parser_util +import vm # Create a tool context to handle options and paths var toolcontext = new ToolContext @@ -30,7 +31,8 @@ var opt = new OptionString("compatibility (does noting)", "-o") toolcontext.option_context.add_option(opt) var opt_eval = new OptionBool("Specifies the program from command-line", "-e") var opt_loop = new OptionBool("Repeatedly run the program for each line in file-name arguments", "-n") -toolcontext.option_context.add_option(opt_eval, opt_loop) +var opt_vm = new OptionBool("Run the virtual machine instead of the naive interpreter (experimental)", "--vm") +toolcontext.option_context.add_option(opt_eval, opt_loop, opt_vm) # We do not add other options, so process them now! toolcontext.process_options(args) @@ -78,6 +80,8 @@ 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 + modelbuilder.run_virtual_machine(self_mm, self_args) else modelbuilder.run_naive_interpreter(self_mm, self_args) end -- 1.7.9.5