|
@@ -103,17 +103,36 @@ include "object_operations.alh"
|
|
|
//
|
|
|
// raise primitive_functions.PrimitiveFinished(instruction + next_inst)
|
|
|
|
|
|
+String function get_indent(indentation : Integer):
|
|
|
+ String code
|
|
|
+ code = ""
|
|
|
+ while (indentation > 0):
|
|
|
+ code = code + "\t"
|
|
|
+ indentation = indentation - 1
|
|
|
+ return code!
|
|
|
+
|
|
|
+String function code_print(node : Element, indentation : Integer):
|
|
|
+ String code
|
|
|
+ code = "(no_printer_for_" + cast_value(node) + ")"
|
|
|
+ return code!
|
|
|
+
|
|
|
Boolean function main(model : Element):
|
|
|
// Read out the main function
|
|
|
String initial_function
|
|
|
String al_node
|
|
|
+ Element initial_function_element
|
|
|
+ get_indent(0)
|
|
|
|
|
|
initial_function = set_pop(allInstances(model, "AL/Initial"))
|
|
|
- initial_function = set_pop(allAssociationDestinations(model, initial_function))
|
|
|
- al_node = cast_value(initial_function)
|
|
|
- log("Read out initial node: " + initial_function)
|
|
|
- log("Value: " + al_node)
|
|
|
-
|
|
|
- // Ready, now branch out
|
|
|
- // TODO
|
|
|
+ initial_function = set_pop(allAssociationDestinations(model, initial_function, "AL/initial_funcdef"))
|
|
|
+ initial_function_element = model["model"][initial_function]["body"]
|
|
|
+ al_node = cast_value(initial_function_element)
|
|
|
+ while (cast_value(initial_function_element) == "global"):
|
|
|
+ initial_function_element = initial_function_element["next"]["next"]
|
|
|
+ log("Started execution at " + cast_value(initial_function_element))
|
|
|
+ log("Started REAL execution at " + cast_value(initial_function_element))
|
|
|
+ String code
|
|
|
+ code = code_print(initial_function_element, 0)
|
|
|
+ log("Generated code:")
|
|
|
+ log(code)
|
|
|
return True!
|