-var mmodules = modelbuilder.parse_and_build([progname])
-modelbuilder.full_propdef_semantic_analysis
+var mmodules: Array[MModule]
+
+if opt_eval.value then
+ var amodule = toolcontext.parse_module(progname)
+ toolcontext.check_errors
+
+ var parent = null
+ if opt_loop.value then
+ parent = modelbuilder.get_mmodule_by_name(null, null, "niti_runtime")
+ if parent == null then
+ toolcontext.check_errors
+ abort
+ end
+ end
+
+ 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