我有一个C++程序中的逻辑非常复杂,需要多个解决方案,使用Prolog是最理想的。它有点像防火墙配置脚本,检查输入是否符合要求,但有时需要执行多个操作。
我的期望是这样的:
class PrologEngine
{
LoadLogic(const char* filename) throw PrologException; // Load a file of prolog rules, predicates facts etc in textual format. Must be callable multiple times to load AND COMPILE (for speed) prolog rule files.
std::vector<std::string> Evaluate(const char* predicate_in_string_form = "execute(input, Result)") throw PrologException; Returns a vector of matching predicates in text form.
};
不需要调用C++的能力。
AMI Prolog似乎可以做到,但它不适用于Linux。我正在尝试使用SWI-Prolog,但只找到了2个示例和一个非常复杂的API(我个人认为)。
有人能向我指出一个接近我寻找的示例吗?