Replies: 1 comment 1 reply
-
|
Hi, Thanks for the feedback. Guan expects a List of string. The consuming code needs to produce that list. See FabricHealer's implementation for a sample of how to read rules from a file into a list: which calls: As you can see, the application above (FabricHealer) employs trailing "." to delimit individual rules for the specific purpose of feeding the rules from a file into a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Today, the user has to provide a list of strings as shown:
var logicRules2 = new List
{
"person(adam)",
"person(betty)",
"person(carl)",
"person(dan)",
"test(?x) :- not(person(?x)), WriteInfo('{0} is not a person', ?x)",
"test(?x) :- WriteInfo('{0} is a person', ?x)"
};
and then parse the rules in that list with the
Module module2 = Module.Parse("persontests", logicRules2, null);
API. In addition to this API I think it would be useful to have an API where the parser did this work for me, possibly aided by a '.' at the end of each fact / rule. The API would then be:
var logicRules3 =
@"person(adam).
person(betty).
person(carl).
person(dan).
var module = Module.Parse("PersonTests", logicRules3, null);
If this is not the case, consumers of Guan need to come up with all sorts of heuristics that deal with delimiting rules, typically based on splitting on newline, which imposes unacceptable compromises to how the user can format complex rules. And, that sort of parsing should really not have to be done by consumers, but by the guan parser, IMO.
BR PV
Beta Was this translation helpful? Give feedback.
All reactions