Browse Source

RAMification is compiling

Yentl Van Tendeloo 8 years ago
parent
commit
e0d1627a83

BIN
bootstrap/bootstrap.m.gz


+ 2 - 2
bootstrap/metamodels.alc

@@ -193,7 +193,7 @@ Element function initialize_SCD(location : String):
 	instantiate_attribute(scd, "tuc", "name", "target_upper_cardinality")
 
 	// Add in the Action Language metamodel
-	add_AL(scd)
+	add_AL_to_MM(scd)
 
 	// And add some, to enforce correct physical types
 	add_constraint(scd, "Natural", constraint_natural)
@@ -275,7 +275,7 @@ Element function create_metamodels():
 
 	return dict_read(dict_read(read_root(), "__hierarchy"), "models")!
 
-Void function add_AL(model : Element):
+Void function add_AL_to_MM(model : Element):
 	instantiate_node(model, "Class", "Action")
 	instantiate_node(model, "Class", "Statement")
 	instantiate_node(model, "Class", "Expression")

+ 12 - 9
bootstrap/ramify.alc

@@ -28,7 +28,7 @@ Element function ramify_func(model : Element, prepost : String):
 	instantiate_node(new_model, "Class", "String")
 
 	// Add in the complete AL metamodel
-	add_AL(new_model)
+	add_AL_to_MM(new_model)
 
 	// Add some default elements
 	if (is_pre):
@@ -72,7 +72,7 @@ Element function ramify_func(model : Element, prepost : String):
 		instantiate_attribute(new_model, "LHS_contains", "name", "contains")
 
 		// Association NAC_contains (NAC, Pre_Element) {}
-		instantiate_link(new_model, "Association", "NAC", "Pre_Element")
+		instantiate_link(new_model, "Association", "NAC_contains", "NAC", "Pre_Element")
 		instantiate_attribute(new_model, "NAC_contains", "name", "contains")
 
 		inheritor = "Pre_Element"
@@ -128,17 +128,20 @@ Element function ramify_func(model : Element, prepost : String):
 		append = "Post_"
 
 	keys = dict_keys(old_m)
+	String type_name
+	String old_source
+	String old_target
 	while (read_nr_out(keys) > 0):
 		key = set_pop(keys)
 		entry = old_m[key]
 
-		type_name = reverseKeyLookup(old_model["metamodel"]["model"], dict_read_node(old_model["type_mapping"], entry))
+		type_name = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], entry))
 		if (type_name == "Class"):
 			instantiate_node(new_model, type_name, append + key)
 
 		elif (bool_or(type_name == "Association", type_name == "Inheritance")):
-			old_source = reverseKeyLookup(old_model["model"], read_edge_src(entry))
-			old_target = reverseKeyLookup(old_model["model"], read_edge_dst(entry))
+			old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
+			old_target = reverseKeyLookup(model["model"], read_edge_dst(entry))
 			instantiate_link(new_model, type_name, append + key, append + old_source, append + old_target)
 
 			// 1) Make it inherit from the Root Element (Pre_Element or Post_Element)
@@ -150,13 +153,13 @@ Element function ramify_func(model : Element, prepost : String):
 			// An instance link, so just copy over (don't make element of Root Element), and don't even copy if it is lower cardinality
 			// It is probably an attribute at the meta-language level, so check which one it is
 			String name
-			name = cast_v2s(read_attribute(old_model["metamodel"], type_name, "name"))
+			name = cast_v2s(read_attribute(model["metamodel"], type_name, "name"))
 			if (bool_not(bool_or(bool_or(name == "lower_cardinality", name == "source_lower_cardinality"), name == "target_lower_cardinality"))):
 				// Not a lower cardinality, so copy
-				source = reverseKeyLookup(old_model["model"], read_edge_src(entry))
-				instantiate_attribute(new_model, source, name, read_edge_dst(entry))
+				old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
+				instantiate_attribute(new_model, append + old_source, append + name, read_edge_dst(entry))
 
-	return new_model
+	return new_model!
 
 Element function ramify(model : Element):
 	Element rv

+ 1 - 1
interface/HUTN/includes/metamodels.alh

@@ -2,4 +2,4 @@ Element function create_metamodels()
 Element function initialize_SCD(location : String)
 Element function initialize_PN(location_SCD : String, location_PN : String)
 Element function initialize_bottom(location : String)
-Void function add_AL(model : Element)
+Void function add_AL_to_MM(model : Element)