Yentl Van Tendeloo преди 9 години
родител
ревизия
d5347eb6d3
променени са 2 файла, в които са добавени 79 реда и са изтрити 78 реда
  1. 3 2
      bootstrap/constructors.alc
  2. 76 76
      bootstrap/primitives.alc

+ 3 - 2
bootstrap/constructors.alc

@@ -351,7 +351,7 @@ Element function instantiate_bottom(model : Element):
 	else:
 		return model
 
-Element function instantiate_model(model : Element):
+Void function instantiate_model(model : Element):
 	Element type
 	type = dict_read(dict_read(dict_read(model, "metamodel"), "model"), input())
 
@@ -381,7 +381,7 @@ Element function instantiate_model(model : Element):
 	if (input()):
 		instantiate_model(model)
 	
-	return 1
+	return
 
 Element function retype_model(model : Element):
 	Element metamodel
@@ -412,3 +412,4 @@ Element function find_attribute(source : Element, attr_name : String, types : El
 				return find_attribute(read_edge_dst(edge), attr_name, types, inheritance_link)
 			i = i + 1
 		// No return at the moment, as this crashes the MvK
+		log("ERROR: could not find attribute")

+ 76 - 76
bootstrap/primitives.alc

@@ -7,96 +7,96 @@ Boolean function bool_eq(a: Boolean, b: Boolean) = ?primitives/bool_eq
 Boolean function bool_neq(a: Boolean, b: Boolean) = ?primitives/bool_neq
 Element function create_node() = ?primitives/create_node
 Element function create_edge(a: Element, b: Element) = ?primitives/create_edge
-Element function create_value(a: Element)  = ?primitives/create_value
-Boolean function is_edge(a: Element)  = ?primitives/is_edge
-Integer function read_nr_out(a: Element)  = ?primitives/read_nr_out
-Element function read_out(a: Element, b: Integer)  = ?primitives/read_out
-Integer function read_nr_in(a: Element)  = ?primitives/read_nr_in
-Element function read_in(a: Element, b: Integer)  = ?primitives/read_in
-Element function read_edge_src(a: Element)  = ?primitives/read_edge_src
-Element function read_edge_dst(a: Element)  = ?primitives/read_edge_dst
-Boolean function delete_element(a: Element)  = ?primitives/delete_element
-Boolean function element_eq(a: Element, b: Element)  = ?primitives/element_eq
-Boolean function element_neq(a: Element, b: Element)  = ?primitives/element_neq
+Element function create_value(a: Element) = ?primitives/create_value
+Boolean function is_edge(a: Element) = ?primitives/is_edge
+Integer function read_nr_out(a: Element) = ?primitives/read_nr_out
+Element function read_out(a: Element, b: Integer) = ?primitives/read_out
+Integer function read_nr_in(a: Element) = ?primitives/read_nr_in
+Element function read_in(a: Element, b: Integer) = ?primitives/read_in
+Element function read_edge_src(a: Element) = ?primitives/read_edge_src
+Element function read_edge_dst(a: Element) = ?primitives/read_edge_dst
+Boolean function delete_element(a: Element) = ?primitives/delete_element
+Boolean function element_eq(a: Element, b: Element) = ?primitives/element_eq
+Boolean function element_neq(a: Element, b: Element) = ?primitives/element_neq
 Float function cast_i2f(a: Integer) = ?primitives/cast_i2f
-String function cast_i2s(a: Integer)  = ?primitives/cast_i2s
-Boolean function cast_i2b(a: Integer)  = ?primitives/cast_i2b
-Integer function cast_f2i(a: Float)  = ?primitives/cast_f2i
-Boolean function cast_f2b(a: Float)  = ?primitives/cast_f2b
-String function cast_f2s(a: Float)  = ?primitives/cast_f2s
-Integer function cast_s2i(a: String)  = ?primitives/cast_s2i
-Float function cast_s2f(a: String)  = ?primitives/cast_s2f
-Boolean function cast_s2b(a: String)  = ?primitives/cast_s2b
-Integer function cast_b2i(a: Boolean)  = ?primitives/cast_b2i
-Float function cast_b2f(a: Boolean)  = ?primitives/cast_b2f
-String function cast_b2s(a: Boolean)  = ?primitives/cast_b2s
-String function cast_e2s(a: Element)  = ?primitives/cast_e2s
-String function cast_a2s(a: Action)  = ?primitives/cast_a2s
-String function cast_t2s(a: Type)  = ?primitives/cast_t2s
-String function cast_v2s(a: Element)  = ?primitives/cast_v2s
-String function cast_id2s(a: Element)  = ?primitives/cast_id2s
+String function cast_i2s(a: Integer) = ?primitives/cast_i2s
+Boolean function cast_i2b(a: Integer) = ?primitives/cast_i2b
+Integer function cast_f2i(a: Float) = ?primitives/cast_f2i
+Boolean function cast_f2b(a: Float) = ?primitives/cast_f2b
+String function cast_f2s(a: Float) = ?primitives/cast_f2s
+Integer function cast_s2i(a: String) = ?primitives/cast_s2i
+Float function cast_s2f(a: String) = ?primitives/cast_s2f
+Boolean function cast_s2b(a: String) = ?primitives/cast_s2b
+Integer function cast_b2i(a: Boolean) = ?primitives/cast_b2i
+Float function cast_b2f(a: Boolean) = ?primitives/cast_b2f
+String function cast_b2s(a: Boolean) = ?primitives/cast_b2s
+String function cast_e2s(a: Element) = ?primitives/cast_e2s
+String function cast_a2s(a: Action) = ?primitives/cast_a2s
+String function cast_t2s(a: Type) = ?primitives/cast_t2s
+String function cast_v2s(a: Element) = ?primitives/cast_v2s
+String function cast_id2s(a: Element) = ?primitives/cast_id2s
 Element function dict_add(a: Element, b: Element, c: Element) = ?primitives/dict_add
 Element function dict_delete(a: Element, b: Element) = ?primitives/dict_delete
-Element function dict_read(a: Element, b: Element)  = ?primitives/dict_read
-Element function dict_read_edge(a: Element, b: Element)  = ?primitives/dict_read_edge
-Element function dict_read_node(a: Element, b: Element)  = ?primitives/dict_read_node
-Integer function dict_len(a: Element)  = ?primitives/dict_len
-Boolean function dict_in(a: Element, b: Element)  = ?primitives/dict_in
-Boolean function dict_in_node(a: Element, b: Element)  = ?primitives/dict_in_node
-Element function dict_keys(a: Element)  = ?primitives/dict_keys
+Element function dict_read(a: Element, b: Element) = ?primitives/dict_read
+Element function dict_read_edge(a: Element, b: Element) = ?primitives/dict_read_edge
+Element function dict_read_node(a: Element, b: Element) = ?primitives/dict_read_node
+Integer function dict_len(a: Element) = ?primitives/dict_len
+Boolean function dict_in(a: Element, b: Element) = ?primitives/dict_in
+Boolean function dict_in_node(a: Element, b: Element) = ?primitives/dict_in_node
+Element function dict_keys(a: Element) = ?primitives/dict_keys
 Float function float_addition(a: Float, b: Float) = ?primitives/float_addition
-Float function float_subtraction(a: Float, b: Float)  = ?primitives/float_subtraction
-Float function float_multiplication(a: Float, b: Float)  = ?primitives/float_multiplication
-Float function float_division(a: Float, b: Float)  = ?primitives/float_division
-Boolean function float_gt(a: Float, b: Float)  = ?primitives/float_gt
-Boolean function float_gte(a: Float, b: Float)  = ?primitives/float_gte
-Boolean function float_lt(a: Float, b: Float)  = ?primitives/float_lt
-Boolean function float_lte(a: Float, b: Float)  = ?primitives/float_lte
-Boolean function float_eq(a: Float, b: Float)  = ?primitives/float_eq
-Boolean function float_neq(a: Float, b: Float)  = ?primitives/float_neq
+Float function float_subtraction(a: Float, b: Float) = ?primitives/float_subtraction
+Float function float_multiplication(a: Float, b: Float) = ?primitives/float_multiplication
+Float function float_division(a: Float, b: Float) = ?primitives/float_division
+Boolean function float_gt(a: Float, b: Float) = ?primitives/float_gt
+Boolean function float_gte(a: Float, b: Float) = ?primitives/float_gte
+Boolean function float_lt(a: Float, b: Float) = ?primitives/float_lt
+Boolean function float_lte(a: Float, b: Float) = ?primitives/float_lte
+Boolean function float_eq(a: Float, b: Float) = ?primitives/float_eq
+Boolean function float_neq(a: Float, b: Float) = ?primitives/float_neq
 Boolean function float_neg(a: Float) = ?primitives/float_neg
 Integer function integer_addition(a: Integer, b: Integer) = ?primitives/integer_addition
-Integer function integer_subtraction(a: Integer, b: Integer)  = ?primitives/integer_subtraction
-Integer function integer_multiplication(a: Integer, b: Integer)  = ?primitives/integer_multiplication
-Integer function integer_division(a: Integer, b: Integer)  = ?primitives/integer_division
-Boolean function integer_gt(a: Integer, b: Integer)  = ?primitives/integer_gt
-Boolean function integer_gte(a: Integer, b: Integer)  = ?primitives/integer_gte
-Boolean function integer_lt(a: Integer, b: Integer)  = ?primitives/integer_lt
-Boolean function integer_lte(a: Integer, b: Integer)  = ?primitives/integer_lte
-Boolean function integer_eq(a: Integer, b: Integer)  = ?primitives/integer_eq
-Boolean function integer_neq(a: Integer, b: Integer)  = ?primitives/integer_neq
+Integer function integer_subtraction(a: Integer, b: Integer) = ?primitives/integer_subtraction
+Integer function integer_multiplication(a: Integer, b: Integer) = ?primitives/integer_multiplication
+Integer function integer_division(a: Integer, b: Integer) = ?primitives/integer_division
+Boolean function integer_gt(a: Integer, b: Integer) = ?primitives/integer_gt
+Boolean function integer_gte(a: Integer, b: Integer) = ?primitives/integer_gte
+Boolean function integer_lt(a: Integer, b: Integer) = ?primitives/integer_lt
+Boolean function integer_lte(a: Integer, b: Integer) = ?primitives/integer_lte
+Boolean function integer_eq(a: Integer, b: Integer) = ?primitives/integer_eq
+Boolean function integer_neq(a: Integer, b: Integer) = ?primitives/integer_neq
 Boolean function integer_neg(a: Integer) = ?primitives/integer_neg
 Element function list_read(a: Element, b: Integer) = ?primitives/list_read
-Element function list_append(a: Element, b: Element)  = ?primitives/list_append
-Element function list_insert(a: Element, b: Element, c: Integer)  = ?primitives/list_insert
-Element function list_delete(a: Element, b: Integer)  = ?primitives/list_delete
-Integer function list_len(a: Element)  = ?primitives/list_len
-Element function set_add(a: Element, b: Element)  = ?primitives/set_add
-Element function set_pop(a: Element)  = ?primitives/set_pop
-Element function set_remove(a: Element, b: Element)  = ?primitives/set_remove
-Boolean function set_in(a: Element, b: Element)  = ?primitives/set_in
-Element function set_remove_node(a: Element, b: Element)  = ?primitives/set_remove_node
-Element function set_in_node(a: Element, b: Element)  = ?primitives/set_in_node
-String function string_join(a: String, b: String)  = ?primitives/string_join
-String function string_get(a: String, b: Integer)  = ?primitives/string_get
-String function string_substr(a: String, b: Integer, c: Integer)  = ?primitives/string_substr
-Integer function string_len(a: String)  = ?primitives/string_len
-Boolean function string_eq(a: String, b: String)  = ?primitives/string_eq
-Boolean function string_neq(a: String, b: String)  = ?primitives/string_neq
-Element function string_split(a: String, b: String)  = ?primitives/string_split
-Boolean function string_startswith(a: String, b: String)  = ?primitives/string_startswith
-Boolean function type_eq(a: Type, b: Type)  = ?primitives/type_eq
-Boolean function type_neq(a: Type, b: Type)  = ?primitives/type_neq
-Type function typeof(a: Element)  = ?primitives/typeof
-Element function deserialize(a: String)  = ?primitives/deserialize
+Element function list_append(a: Element, b: Element) = ?primitives/list_append
+Element function list_insert(a: Element, b: Element, c: Integer) = ?primitives/list_insert
+Element function list_delete(a: Element, b: Integer) = ?primitives/list_delete
+Integer function list_len(a: Element) = ?primitives/list_len
+Element function set_add(a: Element, b: Element) = ?primitives/set_add
+Element function set_pop(a: Element) = ?primitives/set_pop
+Element function set_remove(a: Element, b: Element) = ?primitives/set_remove
+Boolean function set_in(a: Element, b: Element) = ?primitives/set_in
+Element function set_remove_node(a: Element, b: Element) = ?primitives/set_remove_node
+Element function set_in_node(a: Element, b: Element) = ?primitives/set_in_node
+String function string_join(a: String, b: String) = ?primitives/string_join
+String function string_get(a: String, b: Integer) = ?primitives/string_get
+String function string_substr(a: String, b: Integer, c: Integer) = ?primitives/string_substr
+Integer function string_len(a: String) = ?primitives/string_len
+Boolean function string_eq(a: String, b: String) = ?primitives/string_eq
+Boolean function string_neq(a: String, b: String) = ?primitives/string_neq
+Element function string_split(a: String, b: String) = ?primitives/string_split
+Boolean function string_startswith(a: String, b: String) = ?primitives/string_startswith
+Boolean function type_eq(a: Type, b: Type) = ?primitives/type_eq
+Boolean function type_neq(a: Type, b: Type) = ?primitives/type_neq
+Type function typeof(a: Element) = ?primitives/typeof
+Element function deserialize(a: String) = ?primitives/deserialize
 Element function log(a: String) = ?primitives/log
 Element function read_root() = ?primitives/read_root
 
 Element function exec(first_instr : Element):
 	// This does very ugly things, so beware!
 	// Basically, we dynamically construct an if True condition with as body the provided instructions
-	//  after the if conditional, we append a return of an empty element, as we need a return at the end
-	//  returns in the code are therefore allowed (and will be the return value), but not necessarily
+	// after the if conditional, we append a return of an empty element, as we need a return at the end
+	// returns in the code are therefore allowed (and will be the return value), but not necessarily
 	Element n
 	Element exec_if
 	Element exec_const_true