Signed-off-by: Lucas BAJOLET <r4pass@hotmail.com>
intrude import naive_interpreter
+redef class ToolContext
+ # -d
+ var opt_debugger_mode: OptionBool = new OptionBool("Launches the target program with the debugger attached to it", "-d")
+
+ redef init
+ do
+ super
+ self.option_context.add_option(self.opt_debugger_mode)
+ end
+end
+
redef class ModelBuilder
# Execute the program from the entry point (Sys::main) of the `mainmodule'
# `arguments' are the command-line arguments in order
import modelbuilder
import exprbuilder
import naive_interpreter
+import debugger
#import interpretor_type_test
# Create a tool context to handle options and paths
# Here we launch the interpreter on the main module
assert mmodules.length == 1
var mainmodule = mmodules.first
-modelbuilder.run_naive_interpreter(mainmodule, arguments)
+
+if toolcontext.opt_debugger_mode.value then
+ modelbuilder.run_debugger(mainmodule, arguments)
+else
+ modelbuilder.run_naive_interpreter(mainmodule, arguments)
+end