![]() |
YAP 7.1.0
|
Grammar rules in Prolog are both a convenient way to express definite clause grammars and an extension of the well known context-free grammars. More...
Grammar rules in Prolog are both a convenient way to express definite clause grammars and an extension of the well known context-free grammars.
A grammar rule is of the form:
where both head and body are sequences of one or more items linked by the standard conjunction operator ,
Items can be:
[ ]{ and };->) may be inserted in the right hand side of a grammar ruleGrammar related built-in predicates:
| class phrase/2 |
phrase(+ P, L)
This predicate succeeds when L is a phrase of type P The same as phrase(P,L,[])
Both this predicate and the previous are used as a convenient way to start execution of grammar rules
| class phrase/3 |
phrase(+ P, L, R)
This predicate succeeds when the difference list _L_- _R_ is a phrase of type P