我在 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(我的观点)
谁能指出一个与我正在寻找的例子相近的例子?