Some background: I am writing a tool that parses code, produces some constraints to be satisfied, and tries to solve them by finding satisfying assignments for the variables in these constraints (the specifics are beyond the point).
I have written the constraint-solving logic in Prolog but the code parsing and constraint generation is in a C++ front-end. So I want to invoke Prolog from C++, which I am currently doing through a SWI-Prolog API. I need to provide the Prolog solver facts about the parsed code (e.g., variable names) and the generated constraints for it to solve them. Right now, I am providing these facts by invoking assert(fact) through the C++ API (having first declared those predicates as dynamic in the Prolog solver) and then by querying the solver. I am weary of using assert that way, however, for facts that are not really dynamic.
Is there a preferred way of providing these non-dynamic facts to the Prolog solver? Or is asserting them my only/best option?
To be clear, I do not want to emit a list of facts in a .pl file, then fire up a separate process with the solver logic that consults this .pl file, because I'd like the results of the solving to be available in my C++ infrastructure from where I invoke the solver.
Sorry if this has been answered, I'm new to Prolog and having trouble coming up with relevant search terms!
Thanks in advance for any advice!