|
@@ -11,11 +11,11 @@ Element function compilation_manager():
|
|
|
|
|
|
mv_root = read_root()
|
|
|
|
|
|
- if (dict_in(mv_root["__hierarchy"], "models")):
|
|
|
- root = mv_root["__hierarchy"]["models"]
|
|
|
+ if (dict_in(mv_root["__hierarchy"], "objects")):
|
|
|
+ root = mv_root["__hierarchy"]["objects"]
|
|
|
else:
|
|
|
root = create_node()
|
|
|
- dict_add(mv_root["__hierarchy"], "models", root)
|
|
|
+ dict_add(mv_root["__hierarchy"], "objects", root)
|
|
|
|
|
|
operation = input()
|
|
|
if (operation == "upload"):
|
|
@@ -62,7 +62,7 @@ Element function compilation_manager():
|
|
|
log("Failed to understand command")
|
|
|
return operation
|
|
|
|
|
|
-Boolean function check_symbols(root : Element, main_function : String, objs : Element):
|
|
|
+String function check_symbols(root : Element, main_function : String, objs : Element):
|
|
|
Element symbols
|
|
|
String obj
|
|
|
Element keys
|
|
@@ -88,8 +88,7 @@ Boolean function check_symbols(root : Element, main_function : String, objs : El
|
|
|
dict_add(symbols, key, True)
|
|
|
elif (symbols[key]):
|
|
|
// Already in dictionary, and it was already defined
|
|
|
- log("ERROR: multiple definition of symbol " + key)
|
|
|
- return False
|
|
|
+ return "ERROR: multiple definition of symbol " + key
|
|
|
else:
|
|
|
// Already in dictionary, but only used
|
|
|
dict_delete(symbols, key)
|
|
@@ -105,20 +104,21 @@ Boolean function check_symbols(root : Element, main_function : String, objs : El
|
|
|
key = set_pop(keys)
|
|
|
if (bool_not(symbols[key])):
|
|
|
if (bool_not(bool_or(key == "output", key == "input"))):
|
|
|
- log("ERROR: undefined symbol " + key)
|
|
|
- return False
|
|
|
+ return "ERROR: undefined symbol " + key
|
|
|
|
|
|
- return True
|
|
|
+ return "OK"
|
|
|
|
|
|
Void function link_and_load(root : Element, main_function : String, objs : Element):
|
|
|
String obj
|
|
|
Element func
|
|
|
Element main_f
|
|
|
+ String result
|
|
|
|
|
|
- if (check_symbols(root, main_function, objs)):
|
|
|
- // Symbols verified OK, start execution
|
|
|
- output(True)
|
|
|
+ result = check_symbols(root, main_function, objs)
|
|
|
+ output(result)
|
|
|
|
|
|
+ if (result == "OK"):
|
|
|
+ // Symbols verified OK, start execution
|
|
|
// Call all initializers in turn
|
|
|
while (0 < list_len(objs)):
|
|
|
obj = set_pop(objs)
|
|
@@ -128,7 +128,4 @@ Void function link_and_load(root : Element, main_function : String, objs : Eleme
|
|
|
// Resolve the main function, which should now be in (global) scope, and execute it
|
|
|
main_f = resolve(main_function)
|
|
|
main_f()
|
|
|
- else:
|
|
|
- // Symbol verification failed, so don't execute
|
|
|
- output(False)
|
|
|
return
|