Browse Source

New metamodel is merged in and basic conformance checks seem to work

Yentl Van Tendeloo 9 years ago
parent
commit
2fda6044b0

+ 3 - 0
bootstrap/bootstrap.py

@@ -162,15 +162,18 @@ include "constructors.alc"
 include "conformance_scd.alc"
 include "object_operations.alc"
 include "library.alc"
+include "modelling.alc"
 
 Void function __main():
 \tInteger interface
 \twhile (True):
+\t\tlog("User interface select")
 \t\tinterface = input()
 \t\tif (interface == 0):
 \t\t\tlog("DO deserialize")
 \t\t\texec(deserialize(input()))
 \t\telif (interface == 1):
+\t\t\tlog("User entered constructors")
 \t\t\texec(construct_unknown())
 \t\telif (interface == 3):
 \t\t\tcompilation_manager()

+ 3 - 139
bootstrap/conformance_scd.alc

@@ -33,7 +33,7 @@ Boolean function is_nominal_subtype(superclass : Element, subclass : Element, ty
 	Element destination
 
 	// End of recursion
-	if (superclass == subclass):
+	if (element_eq(superclass, subclass)):
 		return True
 
 	// Iterate over all superclasses of the found class
@@ -44,7 +44,7 @@ Boolean function is_nominal_subtype(superclass : Element, subclass : Element, ty
 		// Check if it even has a type (to prevent errors)
 		if (dict_in_node(types, edge)):
 			// Check whether it is an inheritance edge, as there is no other distinction between them
-			if (dict_read_node(types, edge) == inheritance_link):
+			if (element_eq(dict_read_node(types, edge), inheritance_link)):
 				// It is an inheritance edge, so follow it to its destination
 				destination = read_edge_dst(edge)
 				// Found a new superclass to test
@@ -129,6 +129,7 @@ String function conformance_scd(model : Element):
 		if (is_edge(work_node)):
 			model_src = read_edge_src(work_node)
 			metamodel_src = read_edge_src(dict_read_node(typing, work_node))
+			log((getName(model, model_src) + " : ") + getName(model["metamodel"], metamodel_src))
 			if (bool_not(is_nominal_instance(model, model_src, metamodel_src))):
 				return "Source of model edge not typed by source of type: " + getName(model, work_node)
 
@@ -147,149 +148,12 @@ String function conformance_scd(model : Element):
 	else:
 		return "OK"
 
-Element function retype(model : Element, metamodel : Element, inheritance : Element, mapping : Element):
-	if (dict_in(model, "type_mapping")):
-		// Remove previous type mappings
-		dict_delete(model, "type_mapping")
-	if (dict_in(model, "metamodel")):
-		// Remove the previous metamodel too, as this might change too
-		dict_delete(model, "metamodel")
-	if (dict_in(model, "inheritance")):
-		// Remove the inheritance link too, as, yet again, this can vary
-		dict_delete(model, "inheritance")
-	
-	// Start the new configuration of the metamodel and inheritance link, as well as set the new mapping relation
-	dict_add(model, "metamodel", metamodel)
-	dict_add(model, "inheritance", inheritance)
-	dict_add(model, "type_mapping", mapping)
-
-	return model
-
-Element function add_to_model(model : Element, name : String, element : Element):
-	if (name == ""):
-		// No name desired
-		dict_add(model["model"], "__" + cast_id2s(element), element)
-	else:
-		dict_add(model["model"], name, element)
-	return element
-
-Element function instantiate_bottom_node(model : Element, name : String):
-	Element new_element
-	new_element = create_node()
-	return add_to_model(model, name, new_element)
-
-Element function instantiate_bottom_value(model : Element, name : String, value : Element):
-	Element new_element
-	new_element = create_value(value)
-	return add_to_model(model, name, new_element)
-
-Element function instantiate_bottom_edge(model : Element, name : String, source : Element, target : Element):
-	Element new_element
-	new_element = create_edge(source, target)
-	return add_to_model(model, name, new_element)
-
 Element function set_model_constraints(model : Element, func : Element):
 	if (dict_in(model, "constraints")):
 		dict_delete(model, "constraints")
 	dict_add(model, "constraints", func)
 	return model
 
-Element function instantiate_model_lib(model : Element, type : Element, name : String, optionals : Element, attribute_types : Element, attribute_instances : Element):
-	Element new_element
-	if (is_edge(type)):
-		// Create a new edge from "optionals[0]" to "optionals[1]"
-		new_element = instantiate_bottom_edge(model, name, list_read(optionals, 0), list_read(optionals, 1))
-	else:
-		if (has_value(type)):
-			new_element = instantiate_bottom_value(model, name, list_read(optionals, 0))
-		else:
-			new_element = instantiate_bottom_node(model, name)
-
-	// Add it to the type mapping
-	dict_add(model["type_mapping"], new_element, type)
-
-	// Add all attribute types at this level
-	Integer counter
-	Integer max
-	Element keys
-	keys = dict_keys(attribute_types)
-	counter = 0
-	max = list_len(keys)
-
-	Element attr_name
-	Element attr_type
-	Element created_attr
-	Element created_edge
-	Element metamodel
-	metamodel = model["metamodel"]["model"]
-
-	// For all new attributes
-	while (counter < max):
-		attr_name = set_pop(keys)
-		attr_type = attribute_types[attr_name]
-
-		created_attr = create_edge(new_element, attr_type)
-		created_edge = create_edge(created_attr, attr_name)
-		
-		Element m
-		Element tm
-		m = model["model"]
-		tm = model["type_mapping"]
-
-		// Add it to the model
-		dict_add(m, "__" + cast_id2s(attr_name), attr_name)
-		dict_add(m, "__" + cast_id2s(attr_type), attr_type)
-		dict_add(m, "__" + cast_id2s(created_attr), created_attr)
-		dict_add(m, "__" + cast_id2s(created_edge), created_edge)
-
-		// And add the typing
-		dict_add(tm, attr_name, metamodel["__String"])
-		dict_add(tm, attr_type, metamodel["Type"])
-		dict_add(tm, created_attr, metamodel["Attribute"])
-		dict_add(tm, created_edge, metamodel["__Name"])
-
-		// Increase while loop counter
-		counter = counter + 1
-
-	// Similarly for instantiated attributes
-	counter = 0
-	keys = dict_keys(attribute_instances)
-	max = list_len(keys)
-	Element attr_definer_class
-	Element attr_type_edge
-	Element attr_value
-	Element attr_edge
-
-	while (counter < max):
-		// Look it up
-		attr_name = set_pop(keys)
-		attr_value = attribute_instances[attr_name]
-		attr_definer_class = find_attribute(type, attr_name, model["metamodel"]["type_mapping"], model["inheritance"])
-		attr_type = attr_definer_class[attr_name]
-		attr_type_edge = dict_read_edge(attr_definer_class, attr_name)
-		attr_edge = create_edge(new_element, attr_value)
-
-		// Add to model
-		dict_add(model["model"], "__" + cast_id2s(attr_value), attr_value)
-		dict_add(model["model"], "__" + cast_id2s(attr_edge), attr_edge)
-
-		// Type the new elements
-		dict_add(model["type_mapping"], attr_value, attr_type)
-		dict_add(model["type_mapping"], attr_edge, attr_type_edge)
-
-		counter = counter + 1
-
-	return new_element
-
-Element function instantiate_new_model(metamodel : Element, inheritance : Element):
-	Element model
-	model = create_node()
-	dict_add(model, "model", create_node())
-	dict_add(model, "type_mapping", create_node())
-	dict_add(model, "metamodel", metamodel)
-	dict_add(model, "inheritance", inheritance)
-	return model
-
 Element function generate_bottom_type_mapping(model : Element):
 	Element mm
 	mm = model["metamodel"]["model"]

+ 4 - 95
bootstrap/constructors.alc

@@ -2,6 +2,7 @@ include "primitives.alh"
 include "conformance_scd.alh"
 include "library.alh"
 include "io.alh"
+include "modelling.alh"
 
 Element while_stack = ?
 
@@ -132,37 +133,12 @@ Action function construct_unknown():
 	elif (elem == "continue"):
 		return construct_continue()
 	elif (elem == "model"):
-		return construct_model()
+		construct_model()
+		log("Constructed model")
+		return construct_unknown()
 	else:
 		log("ERROR: did not understand command " + cast_e2s(elem))
 
-Void function construct_model():
-	String command
-	while(True):
-		command = input()
-		if (command == "instantiate_model"):
-			// TODO
-		elif (command == "instantiate_bottom"):
-			// TODO
-		elif (command == "add_node"):
-			// TODO
-		elif (command == "add_edge"):
-			// TODO
-		elif (command == "add_value"):
-			// TODO
-		elif (command == "add_element"):
-			// TODO
-		elif (command == "add_attribute"):
-			// TODO
-		elif (command == "add_link"):
-			// TODO
-		elif (command == "retype"):
-			// TODO
-		elif (command == "code"):
-			return construct_unknown()
-		else:
-			log("Model command not understood: " + command)
-
 Action function construct_if():
 	Action this_element
 	this_element = create_value(!if)
@@ -345,73 +321,6 @@ Action function construct_continue():
 	dict_add(this_element, "while", while_stack[list_len(while_stack) - 1])
 	return this_element
 
-Element function instantiate_bottom(model : Element):
-	Element this_element
-	String bottom_type
-	bottom_type = input()
-	String element_name
-	element_name = input()
-
-	// Find out which kind of element we want to create
-	if (bottom_type == "node"):
-		instantiate_bottom_node(model, element_name)
-	elif (bottom_type == "value"):
-		instantiate_bottom_value(model, element_name, input())
-	elif (bottom_type == "edge"):
-		instantiate_bottom_edge(model, element_name, model["model"][input()], model["model"][input()])
-
-	// If there is more to come, we also add these elements
-	if (input()):
-		return instantiate_bottom(model)
-	else:
-		return model
-
-Void function instantiate_model(model : Element):
-	Element type
-	type = model["metamodel"]["model"][input()]
-
-	String name
-	name = input()
-
-	Element params
-	params = create_node()
-	if (is_edge(type)):
-		list_append(params, model["model"][input()])
-		list_append(params, model["model"][input()])
-	elif (has_value(type)):
-		list_append(params, input())
-
-	Element attribute_types
-	attribute_types = create_node()
-	while (input()):
-		dict_add(attribute_types, input(), input())
-
-	Element attribute_instances
-	attribute_instances = create_node()
-	while (input()):
-		dict_add(attribute_instances, input(), input())
-
-	instantiate_model_lib(model, type, name, params, attribute_types, attribute_instances)
-
-	if (input()):
-		instantiate_model(model)
-	
-	return
-
-Element function retype_model(model : Element):
-	Element metamodel
-	metamodel = input()
-
-	Element inheritance
-	inheritance = dict_read(dict_read(input(), "model"), input())
-
-	Element mapping
-	mapping = create_node()
-	while (input()):
-		dict_add(mapping, model["model"][input()], metamodel["model"][input()])
-
-	return retype(model, metamodel, inheritance, mapping)
-
 Element function find_attribute(source : Element, attr_name : String, types : Element, inheritance_link : Element):
 	if (dict_in(source, attr_name)):
 		return source

+ 163 - 0
bootstrap/modelling.alc

@@ -0,0 +1,163 @@
+include "primitives.alh"
+include "io.alh"
+
+String function instantiated_name(element : Element, original : String):
+	if (original == ""):
+		return cast_id2s(element)
+	else:
+		return original
+
+Element function instantiate_bottom():
+	// Just create a new node that serves as the basis for everything
+	// We don't know anything about the model yet, so just create an empty one
+	Element new_model
+
+	// The actual root node of the model
+	new_model = create_node()
+
+	// Add an empty model and empty type mapping
+	dict_add(new_model, "model", create_node())
+	dict_add(new_model, "type_mapping", create_node())
+
+	// Return the created model
+	return new_model
+
+String function model_add_node(model : Element, name : String):
+	// Adds a new node to the specified model with the desired name
+	// This is a bottom operation, as it doesn't take any type
+	Element new_node
+	String actual_name
+
+	new_node = create_node()
+	actual_name = instantiated_name(new_node, name)
+	dict_add(model["model"], actual_name, new_node)
+
+	return actual_name
+
+String function model_add_value(model : Element, name : String, value : Element):
+	// Similar to model_add_node, but add a value as well
+	String actual_name
+
+	actual_name = instantiated_name(value, name)
+	dict_add(model["model"], actual_name, value)
+
+	return actual_name
+
+String function model_add_edge(model : Element, name : String, source : String, destination : String):
+	// Add an edge between the source and destination nodes
+	// Nodes are specified using their string representation previously defined
+	Element new_edge
+	String actual_name
+	
+	new_edge = create_edge(model["model"][source], model["model"][destination])
+	actual_name = instantiated_name(new_edge, name)
+	dict_add(model["model"], actual_name, new_edge)
+
+	return actual_name
+
+Void function retype_model(model : Element, metamodel : Element):
+	// Remove the type mapping and add a new one for the specified metamodel
+	dict_delete(model, "type_mapping")
+	dict_add(model, "type_mapping", create_node())
+	dict_add(model, "metamodel", metamodel)
+	return
+
+Void function retype(model : Element, element : String, type : String):
+	// Retype a model, deleting any previous type the element had
+	// The type string is evaluated in the metamodel previously specified
+	if (dict_in_node(model["type_mapping"], model["model"][element])):
+		dict_delete(model["type_mapping"], model["model"][element])
+	dict_add(model["type_mapping"], model["model"][element], model["metamodel"]["model"][type])
+
+	return
+
+Element function instantiate_model(metamodel : Element):
+	// Instantiate a model
+	// Basically create an untyped model and retype it
+	Element model
+	model = instantiate_bottom()
+	retype_model(model, metamodel)
+	return model
+
+String function instantiate_node(model : Element, type_name : String, instance_name : String):
+	// Create a node typed by a node from the metamodel
+	// Basically create a node and type it immediately
+	String actual_name
+
+	actual_name = model_add_node(model, instance_name)
+	retype(model, instance_name, type_name)
+
+	return actual_name
+
+Void function instantiate_attribute(model : Element, element : String, attribute : String, value : Element):
+	// Instantiate an attribute of something that needs to be instantiated
+	// Actually a bit more difficult than all the rest, as we need to find the attribute to instantiate
+	Element elem
+	Element type
+	Element attr_type
+
+	elem = model["model"][element]
+	type = model["type_mapping"][elem]
+	//attr_type = find_attribute(model, type, attribute)
+	instantiate_link(model, attr_type, "", elem, value)
+
+	return
+
+String function instantiate_link(model : Element, type : String, name : String, source : String, destination : String):
+	// Create a typed link between two nodes
+	String actual_name
+
+	actual_name = model_add_edge(model, name, source, destination)
+	retype(model, actual_name, type)
+
+	return actual_name
+
+Void function instantiate_named_value(model : Element, type : String, name : String, source : String, destination : Element):
+	// Special helper function to create an edge and name it
+	String actual_name
+
+	actual_name = instantiate_link(model, type, "", source, destination)
+	instantiate_attribute(model, model["model"][actual_name], "name", name)
+
+	return
+
+Void function instantiate_named(model : Element, type : String, name : String, source : String, destination : String):
+	// Special helper function to create an edge and name it
+	instantiate_named(model, type, name, source, model["model"][destination])
+
+	return
+
+Void function define_inheritance(model : Element, inheritance_name : String):
+	// Set the inheritance link to the one defined in our own metamodel, given by the specified name
+	dict_add(model, "inheritance", model["metamodel"]["model"][inheritance_name])
+
+	return
+
+Void function construct_model():
+	String command
+	log("Enter modelling constructs!")
+	while (True):
+		command = input()
+
+		if (command == "instantiate_bottom"):
+			output(instantiate_bottom())
+		elif (command == "add_node"):
+			model_add_node(input(), input())
+		elif (command == "add_value"):
+			model_add_value(input(), input(), input())
+		elif (command == "add_edge"):
+			model_add_edge(input(), input(), input(), input())
+		elif (command == "exit"):
+			return
+		elif (command == "retype_model"):
+			retype_model(input(), input())
+		elif (command == "retype"):
+			retype(input(), input(), input())
+		elif (command == "instantiate_model"):
+			output(instantiate_model(input()))
+		elif (command == "instantiate_attribute"):
+			instantiate_named(input(), input(), input(), input(), input())
+		elif (command == "define_inheritance"):
+			define_inheritance(input(), input())
+		else:
+			log("Modelling error: did not understand command " + command)

+ 0 - 15
bootstrap/object_operations.alc

@@ -86,21 +86,6 @@ Element function readAttribute(model : Element, source : Element, attr_name : St
 
 	return read_edge_dst(set_pop(allOutgoingAssociationInstances(model, source, edge)))
 
-Element function setAttribute(model : Element, source : Element, attr_name : String, value : Element):
-	// Read out which edge we are talking about
-	Element edge
-	edge = deleteAttribute(model, source, attr_name)
-
-	// Now make the element
-	Element created_edge
-	created_edge = create_edge(source, value)
-	dict_add(model["type_mapping"], created_edge, edge)
-	dict_add(model["type_mapping"], value, read_edge_dst(edge))
-	add_to_model(model, "", value)
-	add_to_model(model, "", created_edge)
-
-	return True
-
 Element function deleteAttribute(model : Element, source : Element, attr_name : Element):
 	Element edge
 	edge = findAttribute(dict_read_node(model["type_mapping"], source), attr_name, model["type_mapping"], model["inheritance"])

+ 76 - 76
integration/test_constructors_models.py

@@ -13,89 +13,88 @@ def flatten(lst):
             new_lst.append(f)
     return new_lst
 
-bottom = ['"instantiate_bottom"',
-            '"node"', '"Class"', 'true',
-            '"node"', '"Type"', 'true',
-            '"node"', '"__String"', 'true',
-            '"value"', '"__name"', '"name"', 'true',
-            '"edge"', '"Attribute"', '"Class"', '"Type"', 'true',
-            '"edge"', '"__Name"', '"Attribute"', '"__String"', 'true',
-            '"edge"', '"Association"', '"Class"', '"Class"', 'true',
-            '"edge"', '"Inheritance"', '"Class"', '"Class"', 'true',
-            '"edge"', '"__name_edge"', '"__Name"', '"__name"', 'true',
-            '"edge"', '"__inh_1"', '"Association"', '"Class"', 'true',
-            '"edge"', '"__inh_2"', '"Attribute"', '"Class"', 'true',
-            '"value"', '"__attribute"', '"attribute"', 'true',
-            '"edge"', '"__attribute_edge"', '"Attribute"', '"__attribute"', 'false',
-            1,
-        ]
+bottom = [
+        '"model"',
+        '"instantiate_bottom"', 1,
+        '"add_node"', 1, '"Class"', 
+        '"add_node"', 1, '"Type"',
+        '"add_node"', 1, '"Any"',
+        '"add_node"', 1, '"String"',
+        '"add_value"', 1, '"inheritance"', '"inheritance"',
+        '"add_value"', 1, '"link"', '"link"',
+        '"add_value"', 1, '"name"', '"name"',
+        '"add_edge"', 1, '"l1"', '"Class"', '"Any"',
+        '"add_edge"', 1, '"l2"', '"Type"', '"Any"',
+        '"add_edge"', 1, '"l3"', '"Any"', '"Any"',
+        '"add_edge"', 1, '"l4"', '"l3"', '"inheritance"',
+        '"add_edge"', 1, '"l5"', '"Any"', '"Any"',
+        '"add_edge"', 1, '"l6"', '"l5"', '"Any"',
+        '"add_edge"', 1, '"l7"', '"l5"', '"link"',
+        '"add_edge"', 1, '"l8"', '"l5"', '"String"',
+        '"add_edge"', 1, '"l9"', '"l8"', '"name"',
+        '"exit"',
+    ]
 
-retype = ['"retype_model"',
-            1,
-            1,
-            1, '"Inheritance"',
-            'true',
-                '"Class"', '"Class"', 'true',
-                '"Type"', '"Type"', 'true',
-                '"__String"', '"Type"', 'true',
-                '"Attribute"', '"Attribute"', 'true',
-                '"__Name"', '"Attribute"', 'true',
-                '"Association"', '"Association"', 'true',
-                '"Inheritance"', '"Association"', 'true',
-                '"__inh_1"', '"Inheritance"', 'true',
-                '"__inh2"', '"Inheritance"', 'true',
-                '"__name"', '"__String"', 'true',
-                '"__name_edge"', '"__Name"', 'true',
-                '"__attribute"', '"__String"', 'true',
-                '"__attribute_edge"', '"__Name"', 'false',
-        ]
+retype = [
+        '"model"', 
+        '"retype_model"', 1, 1,
+        '"retype"', 1, '"Class"', '"Class"',
+        '"retype"', 1, '"Type"', '"Class"',
+        '"retype"', 1, '"Any"', '"Class"',
+        '"retype"', 1, '"String"', '"Type"',
+        '"retype"', 1, '"inheritance"', '"String"',
+        '"retype"', 1, '"link"', '"String"',
+        '"retype"', 1, '"name"', '"String"',
+        '"retype"', 1, '"l1"', '"l3"',
+        '"retype"', 1, '"l2"', '"l3"',
+        '"retype"', 1, '"l3"', '"l5"',
+        '"retype"', 1, '"l4"', '"l8"',
+        '"retype"', 1, '"l5"', '"l5"',
+        '"retype"', 1, '"l6"', '"l3"',
+        '"retype"', 1, '"l7"', '"l8"',
+        '"retype"', 1, '"l8"', '"l5"',
+        '"retype"', 1, '"l9"', '"l8"',
+        '"define_inheritance"', 1, '"l3"',
+        '"exit"',
+    ]
 
-def function_call(func, paramA, paramB):
-    return ['"output"', '"call"', 
-                '"access"',
-                '"resolve"', '"%s"' % func,
-                '3',
-                    '"const"', 3,
-                    '"call"',
-                '"access"',
-                        '"resolve"', '"dict_read"',
-                        '2',
-                        '"call"',
-                '"access"',
-                            '"resolve"', '"dict_read"',
-                            '2',
-                            '"const"', 3,
-                            '"const"', '"model"',
-                            'false',
-                        '"const"', '"%s"' % paramA,
-                        'false',
-                    '"call"',
-                '"access"',
-                        '"resolve"', '"dict_read"',
-                        '2',
-                        '"call"',
-                '"access"',
-                            '"resolve"', '"dict_read"',
-                            '2',
-                            '"const"', 2,
-                            '"const"', '"model"',
-                            'false',
-                        '"const"', '"%s"' % paramB,
-                        'false',
-                'false',
+instantiate_pn = [
+        '"model"',
+        '"instantiate_model"', 1, 2,
+        '"instantiate_node"', 1, '"Class"', '"Place"',
+        '"instantiate_node"', 1, '"Class"', '"Transition"',
+        '"instantiate_node"', 1, '"Type"', '"Integer"',
+        '"instantiate_named"', 1, '"l5"', '"P2T"', '"Place"', '"Transition"',
+        '"instantiate_named"', 1, '"l5"', '"T2P"', '"Transition"', '"Place"',
+        '"instantiate_named"', 1, '"l5"', '"tokens"', '"Place"', '"Integer"',
+        '"instantiate_named"', 1, '"l5"', '"weight"', '"P2T"', '"Integer"',
+        '"instantiate_named"', 1, '"l5"', '"weight"', '"T2P"', '"Integer"',
+        '"exit"',
+    ]
+
+def conformance_check(node):
+    return [
+            '"output"',
+                '"call"',
+                    '"access"', '"resolve"', '"conformance_scd"',
+                    '1',
+                    '"const"', node,
+                    'false',
                 'true',
+            '"return"',
+                'false',
             ]
-        
+
 class TestConstructorsModels(unittest.TestCase):
     def test_constructors_instantiate_bottom(self):
-        commands = bottom + [ 
-                    '"output"', '"const"', '3',
-                        'true',
-                    '"return"', 'true',
-                        '"const"', 'true',
-                ]
-        self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
+        commands = bottom + retype + conformance_check(1)
+        self.assertTrue(run_barebone(commands, ["OK"], 1))
+
+    def test_constructors_instantiate_petrinet(self):
+        commands = bottom + retype + instantiate_pn + conformance_check(2)
+        self.assertTrue(run_barebone(commands, ["OK"], 1))
 
+    """
     def test_constructors_instantiate_model(self):
         commands = bottom + [
                     '"instantiate_model"',
@@ -815,3 +814,4 @@ class TestConstructorsModels(unittest.TestCase):
                         '"const"', 'true',
                 ]
         self.assertTrue(run_barebone(flatten(commands), ['5', '1', '2', '10', '16', '30'], 1))
+    """

+ 3 - 3
interface/HUTN/hutn_compiler/compiler.py

@@ -57,8 +57,8 @@ def do_parse(inputfile, grammarfile):
     except:
         result = Parser(grammar, line_position = True).parse(read(inputfile))
         if result['status'] != Parser.Constants.Success:
-            print('not a valid input file: %s' % inputfile)
-            print(result)
+            msg = "%s:%s:%s: %s" % (inputfile, result["line"], result["column"], result["text"])
+            raise Exception(msg)
         pickle.dump(result, open(picklefile, 'wb'), pickle.HIGHEST_PROTOCOL)
 
     return result
@@ -89,7 +89,7 @@ def do_compile(inputfile, grammarfile, visitors=[], include_paths = []):
     result = do_parse(inputfile, grammarfile)
     error = result["status"] != Parser.Constants.Success
     if error:
-        msg = "Not a valid input file!\n%s:%s: error: %s" % (result['line'], result['column'], result['text'])
+        msg = "%s:%s:%s: %s" % (inputfile, result["line"], result["column"], result["text"])
         raise Exception(msg)
     else:
         for child in result["tree"].tail:

+ 0 - 7
interface/HUTN/includes/conformance_scd.alh

@@ -4,12 +4,5 @@ Boolean function is_nominal_subtype(a: Element, b: Element, c: Element, d: Eleme
 Boolean function is_structural_subtype(a: Element, b: Element)
 Boolean function is_structural_instance(a: Element, b: Element, c: Element)
 Element function conformance_scd(a: Element)
-Element function retype(a: Element, b: Element, c: Element, d: Element)
-Element function add_to_model(a: Element, b: String, c: Element)
-Element function instantiate_bottom_node(a: Element, b: String)
-Element function instantiate_bottom_value(a: Element, b: String, c: Element)
-Element function instantiate_bottom_edge(a: Element, b: String, c: Element, d: Element)
 Element function set_model_constraints(a: Element, b: Element)
-Element function instantiate_model_lib(a: Element, b: Element, c: String, d: Element, e: Element, f: Element)
-Element function instantiate_new_model(a: Element, b: Element)
 Element function generate_bottom_type_mapping(a: Element)

+ 0 - 3
interface/HUTN/includes/constructors.alh

@@ -1,6 +1,3 @@
 Action function construct_top()
 Action function construct_unknown()
 Element function find_attribute(a: Element, b: Element, c: Element, d: Element)
-Element function retype_model(a: Element)
-Element function instantiate_model(a: Element)
-Element function instantiate_bottom(a: Element)

+ 4 - 0
interface/HUTN/includes/modelling.alh

@@ -0,0 +1,4 @@
+Element function instantiate_bottom()
+Void function retype_model(model : Element, metamodel : Element)
+Void function retype(model : Element, element : String, type : String)
+Void function construct_model()

+ 3 - 0
prompt.py

@@ -41,6 +41,9 @@ if username == "":
 else:
     username = username.strip()
 
+# If user shouldn't exist yet, we create it
+urllib2.urlopen(urllib2.Request("http://%s:%s/" % (address, port), urllib.urlencode({"op": "set_input", "element_type": "V", "value": '"%s"' % username, "username": "user_manager"}))).read()
+
 local_print("Switching context to Modelverse: all data is piped.")
 local_print("To quit: execute command 'quit'")