1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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 = 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, model : Element):
- String port
- port = comm_connect("compiler")
- 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(model, list)!
|