|
|
@@ -12,13 +12,13 @@ Element variable_map = ?
|
|
|
Element function construct_function_list(list : Element):
|
|
|
String command
|
|
|
Element result
|
|
|
- Element main_function
|
|
|
+ String main_function
|
|
|
Boolean continue
|
|
|
- Element prev_element
|
|
|
- Element first_element
|
|
|
+ String prev_element
|
|
|
+ String first_element
|
|
|
|
|
|
Element model
|
|
|
- model = instantiate_model("formalisms/ActionLanguage")
|
|
|
+ model = instantiate_model(import_node("models/ActionLanguage"))
|
|
|
|
|
|
list = list_reverse(list)
|
|
|
|
|
|
@@ -45,7 +45,7 @@ Element function construct_function_list(list : Element):
|
|
|
return read_root()!
|
|
|
|
|
|
continue = list_pop_final(list)
|
|
|
- if (prev_element != read_root()):
|
|
|
+ if (element_neq(prev_element, read_root())):
|
|
|
dict_add_fast(prev_element, "next", result["start"])
|
|
|
else:
|
|
|
first_element = result["start"]
|
|
|
@@ -68,13 +68,16 @@ Element function construct_function_list(list : Element):
|
|
|
|
|
|
// Overwrite the main function with our declaration function
|
|
|
prev_element = set_pop(allAssociationDestinations(model, main_function, "funcdef_body"))
|
|
|
- log("Got parameters for main function: " + set_to_string(dict_keys(model["model"][main_function])))
|
|
|
+ log("Got main function: " + main_function)
|
|
|
+ log("Got main function: " + set_to_string(dict_keys(model["model"][main_function])))
|
|
|
+ log("Parameters stored in " + cast_string(reverseKeyLookup(model["model"], model["model"][main_function]["params"])))
|
|
|
+ log("Got parameters for main function: " + set_to_string(dict_keys(model["model"][main_function]["params"])))
|
|
|
model_delete_element(model, set_pop(allOutgoingAssociationInstances(model, main_function, "funcdef_body")))
|
|
|
create_al_link(model, "funcdef_body", main_function, first_element, "body")
|
|
|
create_al_link(model, "Statement_next", result["end"], prev_element, "next")
|
|
|
-
|
|
|
instantiate_link(model, "initial_funcdef", "", instantiate_node(model, "Initial", ""), main_function)
|
|
|
|
|
|
+ log("Created model!")
|
|
|
return model!
|
|
|
|
|
|
Void function create_al_link(model : Element, linktype : String, source : String, target : String, dictname : String):
|
|
|
@@ -87,7 +90,7 @@ String function construct_global(model : Element, list : Element):
|
|
|
String op
|
|
|
|
|
|
this_element = instantiate_value(model, "global", "", create_value(!global))
|
|
|
- declared_element = list_pop_final(list)
|
|
|
+ declared_element = instantiate_value(model, "String", "", create_value(list_pop_final(list)))
|
|
|
create_al_link(model, "global_var", this_element, instantiate_value(model, "String", "", declared_element), "var")
|
|
|
|
|
|
op = list_pop_final(list)
|
|
|
@@ -138,9 +141,9 @@ String function construct_funcdef(model : Element, list : Element, mutable : Boo
|
|
|
String assign
|
|
|
String resolve
|
|
|
String constant
|
|
|
- Element formal
|
|
|
- Element func
|
|
|
- Element params
|
|
|
+ String formal
|
|
|
+ String func
|
|
|
+ String params
|
|
|
String declare
|
|
|
String name
|
|
|
|
|
|
@@ -178,8 +181,12 @@ String function construct_funcdef(model : Element, list : Element, mutable : Boo
|
|
|
|
|
|
while (counter < nrParams):
|
|
|
param = instantiate_node(model, "Element", "")
|
|
|
+ log("Adding parameter: " + string_get(arg_names_decl, counter))
|
|
|
+ log(" func " + func)
|
|
|
+ log(" params " + params)
|
|
|
create_al_link(model, "param_dict_link", params, param, string_get(arg_names_decl, counter))
|
|
|
- dict_add_fast(variable_map, list_pop_final(list), model["model"][param])
|
|
|
+ log("After append: " + set_to_string(dict_keys(model["model"][params])))
|
|
|
+ dict_add_fast(variable_map, list_pop_final(list), param)
|
|
|
// Output each parameter in turn
|
|
|
counter = counter + 1
|
|
|
|