1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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:
- comm_close(port)
- return response!
- 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 (is_physical_string(list)):
- return list!
- else:
- Element model
- model = construct_function_list(list)
- dict_add(model, "__text", code)
- return model!
- Element function compile_model(code : String, metamodel : Element):
- String port
- port = ""
- while (port == ""):
- port = comm_connect("compiler")
- comm_set(port, "model")
- Element list
- list = generic_compile(code, port)
- if (is_physical_string(list)):
- return list!
- else:
- return construct_model_list(instantiate_model(metamodel), list)!
|