|
@@ -8,8 +8,8 @@ def bootstrap():
|
|
|
root = ["__hierarchy"]
|
|
|
|
|
|
task_manager = "task_manager"
|
|
|
- initial_code_manager = "bootstrap/initial_code_manager.alc"
|
|
|
- initial_code_task = "bootstrap/initial_code_task.alc"
|
|
|
+ main_file = "bootstrap/main.alc"
|
|
|
+ primitive_file = "bootstrap/primitives.alc"
|
|
|
|
|
|
task_data = [ "input",
|
|
|
"output",
|
|
@@ -217,24 +217,46 @@ def bootstrap():
|
|
|
# Compile the subfile
|
|
|
bootstrap_file = bootstrap_file.replace("\\", "/")
|
|
|
print("[ALC] %s" % bootstrap_file)
|
|
|
- f.write(compile_code_AL(bootstrap_file, "initial_IP", prepend=bootstrap_file, main = bootstrap_file in [initial_code_manager, initial_code_task]), both=False)
|
|
|
+ f.write(compile_code_AL(bootstrap_file, "initial_IP", prepend=bootstrap_file, main=bootstrap_file==main_file), both=False)
|
|
|
+
|
|
|
+ # TODO all assigns stored in:
|
|
|
+ # bootstrap_file + "_initial_IP"
|
|
|
|
|
|
# Now link the code with the compilation manager structure
|
|
|
- f.write("Node elem()\n", both=False)
|
|
|
|
|
|
- f.write('Dict (__objects, "%s", elem)\n' % bootstrap_file, both=False)
|
|
|
- f.write('Dict (elem, "initializers", %s_initial_IP)\n' % bootstrap_file, both=False)
|
|
|
+ # Stitch all IPs together
|
|
|
+ print("[LINK]")
|
|
|
+ counter = 0
|
|
|
+ f.write('Node true(constant)\n', both=False)
|
|
|
+ f.write('Node t(True)\n', both=False)
|
|
|
+ f.write('Dict (true, "node", t)\n', both=False)
|
|
|
+
|
|
|
+ first = True
|
|
|
+ for bootstrap_file in [primitive_file] + [i for i in bootstrap_files if i not in [main_file, primitive_file]]:
|
|
|
+ f.write('Node _if_%s(if)\n' % counter, both=False)
|
|
|
+ f.write('Dict (_if_%s, "cond", true)\n' % counter, both=False)
|
|
|
+ f.write('Dict (_if_%s, "then", %s_initial_IP)\n' % (counter, bootstrap_file), both=False)
|
|
|
+
|
|
|
+ if first:
|
|
|
+ first = False
|
|
|
+ else:
|
|
|
+ f.write('Dict (%s, "next", _if_%s)\n' % (prev, counter), both=False)
|
|
|
+
|
|
|
+ prev = "_if_%s" % counter
|
|
|
+ counter += 1
|
|
|
+
|
|
|
+ f.write('Dict (%s, "next", %s_initial_IP)\n' % (prev, main_file), both=False)
|
|
|
|
|
|
# Create code for initial task
|
|
|
print("[BOOT] task_manager")
|
|
|
- f.write('Dict (task_frame, "IP", %s_initial_IP)\n' % (initial_code_manager), both=False)
|
|
|
+ f.write('Dict (task_frame, "IP", _if_0)\n', both=False)
|
|
|
|
|
|
f.write('Node __phase("init")\n', both=False)
|
|
|
f.write('Dict (task_frame, "phase", __phase)\n', both=False)
|
|
|
|
|
|
# Create code for new tasks to start at
|
|
|
print("[BOOT] new_task")
|
|
|
- f.write('Dict (__hierarchy, "__IP", %s_initial_IP)\n' % initial_code_task, both=False)
|
|
|
+ f.write('Dict (__hierarchy, "__IP", _if_0)\n', both=False)
|
|
|
except:
|
|
|
os.remove("bootstrap/bootstrap.m.gz")
|
|
|
os.remove("bootstrap/minimal.m.gz")
|