Wal*_*ard 5 c++ embed prolog swi-prolog
我在 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.
};
Run Code Online (Sandbox Code Playgroud)
它不需要回调 C++ 的能力。
AMI Prolog 似乎可以使用它,但它在 Linux 上不可用。我正在尝试使用 SWI-Prolog,但只能找到 2 个示例和令人难以置信的拜占庭 API(我的意见)
谁能给我指出一个与我正在寻找的内容接近的例子?