Explorar o código

Fixed the = ? syntax in definitions: now generates a global for each user

Yentl Van Tendeloo %!s(int64=8) %!d(string=hai) anos
pai
achega
6d641d8037

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 105590 - 104923
bootstrap/bootstrap.m


+ 13 - 2
bootstrap/constructors.alc

@@ -23,6 +23,7 @@ Action function construct_global():
 	String declared_element
 	String op
 
+	log("Construct global")
 	this_element = create_value(!global)
 	declared_element = input()
 	dict_add(this_element, "var", declared_element)
@@ -37,12 +38,22 @@ Action function construct_global():
 	dict_add(assign, "var", resolve)
 	dict_add(resolve, "var", declared_element)
 	op = input()
-	value = create_value(!constant)
 	if (op == "deref"):
+		value = create_value(!constant)
 		dict_add(value, "node", import_node(input()))
 	elif (op == "empty"):
-		dict_add(value, "node", create_node())
+		log("EMPTY")
+		value = create_value(!call)
+		Element res
+		Element acc
+		res = create_value(!resolve)
+		acc = create_value(!access)
+		dict_add(value, "func", acc)
+		dict_add(acc, "var", res)
+		dict_add(res, "var", "create_node")
+		log("Created create_node call")
 	elif (op == "const"):
+		value = create_value(!constant)
 		dict_add(value, "node", input())
 	dict_add(assign, "value", value)
 

+ 7 - 5
interface/HUTN/hutn_compiler/primitives_visitor.py

@@ -414,12 +414,14 @@ class PrimitivesVisitor(Visitor):
         self.visit_atomvalue(tree.get_tail()[-1])
         value = self.get_primitive(tree.get_tail()[-1])
 
-        #TODO hack...
         if value is None:
-            const = self.value("constant")
-            value = self.node()
-            self.dict(const, "node", value)
-            value = const
+            call = self.value("call")
+            access = self.value("access")
+            resolve = self.value("resolve")
+            self.dict(call, "func", access)
+            self.dict(access, "var", resolve)
+            self.dict(resolve, "var", self.value('"create_node"'))
+            value = call
 
         self.dict(assign, "value", value)
 

+ 1 - 0
kernel/modelverse_kernel/main.py

@@ -421,6 +421,7 @@ class ModelverseKernel(object):
                                    ("CNV", ["finish"]),
                                   ]
             if variable is None:
+                print("READ " + str(var))
                 raise Exception("%s: not found as global: %s" % (self.debug_info, var_name))
 
             # Resolved a global, so this is a string