include "primitives.alh" include "services.alh" include "constructors.alh" include "modelling.alh" Element function generic_compile(code : String, port : String): comm_set(port, code) String response response = comm_get(port) if (response == "OK"): Element lst lst = comm_get_list(port) comm_close(port) return lst! else: log("Compilation error: " + response) comm_close(port) return read_root()! Element function compile_code(code : String): String port port = "" while (port == ""): port = comm_connect("compiler") comm_set(port, "code") Element list list = generic_compile(code, port) if (element_eq(list, read_root())): return read_root()! else: return construct_function_list(list)! Element function compile_model(code : String, metamodel : Element): String port port = "" while (port == ""): port = comm_connect("compiler") sleep(0.5) comm_set(port, "model") Element list list = generic_compile(code, port) if (element_eq(list, read_root())): return read_root()! else: return construct_model_list(instantiate_model(metamodel), list)!