Browse Source

Fix bootstrap file not being properly uploaded

Yentl Van Tendeloo 5 years ago
parent
commit
330fe37bf3

+ 2 - 1
bootstrap/bootstrap.py

@@ -214,7 +214,7 @@ def bootstrap():
                     # Compile the subfile
                     bootstrap_file = bootstrap_file.replace("\\", "/")
                     print("[ALC] %s" % bootstrap_file)
-                    all_code += open(bootstrap_file, 'r').read()
+                    all_code += "".join([i.replace(" = ?\n", "\n") for i in open(bootstrap_file, 'r').readlines() if not i.startswith("include ")])
                     f.write(compile_code_AL(bootstrap_file, "initial_IP", prepend=bootstrap_file, main=bootstrap_file==main_file), both=False)
 
                     # TODO all assigns stored in:
@@ -223,6 +223,7 @@ def bootstrap():
                     # Now link the code with the compilation manager structure
 
                 print("[MERGE]")
+                all_code += "Void function main():\n\tlog(\"INIT\")\n\treturn!"
                 with open("bootstrap/merged.alm", 'w') as merged:
                     merged.write(all_code)
 

+ 1 - 1
bootstrap/constructors.alc

@@ -100,7 +100,7 @@ String function construct_global(model : Element, list : Element):
 		create_al_link(model, "resolve_var", resolve, declared_element, "var")
 		if (op == "deref"):
 			value = instantiate_value(model, "constant", "", create_value(!constant))
-			create_al_link(model, "constant_node", this_element, value, "node")
+			create_al_link(model, "constant_node", value, instantiate_value(model, "String", "", list_pop_final(list)), "node")
 		elif (op == "empty"):
 			value = instantiate_value(model, "call", "", create_value(!call))
 			String res

+ 1 - 1
bootstrap/core_algorithm.alc

@@ -2589,7 +2589,7 @@ Void function new_task():
 			// Execute it directly
 			Element func
 			func = get_func_AL_model(get_full_model(core_model, get_entry_id("formalisms/ActionLanguage")))
-			func(read_root())
+			func()
 
 		output("Welcome to the Model Management Interface v2.0!")
 		output("Use the 'help' command for a list of possible commands")

+ 1 - 0
kernel/modelverse_kernel/main.py

@@ -1473,6 +1473,7 @@ class ModelverseKernel(object):
                               ]
 
         value, =        yield [("RV", [new_var])]
+        print("GLOB " + str(value))
         exists, =       yield [("RDE", [global_symbols, value])]
 
         if exists is not None:

File diff suppressed because it is too large
+ 13 - 23
notebook.ipynb


+ 1 - 1
scripts/test_compile.py

@@ -1,4 +1,4 @@
 import sys
 sys.path.append("interface/HUTN/")
 from hutn_compiler.compiler import main as compile_code
-compile_code(sys.argv[1], "interface/HUTN/grammars/actionlanguage.g", "CS")
+print(compile_code(sys.argv[1], "interface/HUTN/grammars/actionlanguage.g", "CS"))