expand_term/2
hookableexpand_term(
+Term1,
-Term2)
Transforms grammar rules into Prolog clauses before they are compiled.
Normally called by the compiler, but can be called directly. The transform
can be customized by defining the hook term_expansion/2
.
Usually called by the built-in Load Predicates and not directly by user programs.
Normally used to translate grammar rules, written with -->/2
,
into ordinary Prolog clauses, written with :-/2
. If
Term1 is a grammar rule, then Term2 is the
corresponding clause. Otherwise Term2 is simply
Term1 unchanged.
If Term1 is not of the proper form, or if Term2 does not
unify with its clausal form, expand_term/2
simply fails.
Calls term_expansion/2
.
Prints messages for exceptions
raised by term_expansion/2
.
See examples in ref-gru-tra.
term_expansion/2
, phrase/[2,3]
,
'C'/3
, -->/2
ref-gru