4.14.2 How to Use the Grammar Rule Facility
Following is a summary of the steps that enable you to construct and
utilitze definte clause grammars:
STEPS:
- Write a grammar, using
-->/2
to formulate rules.
- Compile the file containing the grammar rules. The Load
Predicates automatically translate the grammar rules
into Prolog clauses.
- Use
phrase/[2,3]
to parse or generate strings.
OPTIONAL STEPS:
- Modify the way in which Prolog translates your grammar rules
by defining clauses for
user:term_expansion/6
;
see ref-lod-exp.
- In debugging or in using the grammar facility for more obscure
purposes it may be useful to understand more about
expand_term/2
.
Send feedback on this subject.