【发布时间】:2012-03-07 00:42:54
【问题描述】:
我在 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(我的观点)
谁能指出一个与我正在寻找的例子相近的例子?
【问题讨论】:
-
这篇博文有一个小例子说明你想用 swi-prolog 做什么:electricbacon.wordpress.com/2010/09/08/…
-
为什么不用 CLIPS 而不是 prolog? clipsrules.sourceforge.net/WhatIsCLIPS.html
标签: c++ prolog embed swi-prolog