built-in method
phrase/3
ï
Descriptionï
phrase(GrammarRuleBody, Input, Rest)
phrase(::GrammarRuleBody, Input, Rest)
phrase(Object::GrammarRuleBody, Input, Rest)
True when the GrammarRuleBody
grammar rule body can be applied to
the Input-Rest
difference list of tokens. In the most common case,
GrammarRuleBody
is a non-terminal defined by a grammar rule. This
built-in method is declared private and thus cannot be used as a message
to an object. When using a backend Prolog compiler supporting a
module system, calls in the format
phrase(Module:GrammarRuleBody, Input, Rest)
may also be used.
This method is opaque to cuts in the first argument. When the first argument is sufficiently instantiated at compile-time, the method call is compiled in order to eliminate the implicit overheads of converting the grammar rule body into a goal and meta-calling it. For performance reasons, the second and third arguments are only type-checked at compile time.
Meta-predicate templateï
phrase(2, *, *)
Modes and number of proofsï
phrase(+callable, ?list, ?list) - zero_or_more
Errorsï
GrammarRuleBody
is a variable:instantiation_error
GrammarRuleBody
is neither a variable nor a callable term:type_error(callable, GrammarRuleBody)
Examplesï
phrase(NonTerminal, Input, Rest)
phrase(::NonTerminal, Input, Rest)
phrase(Object::NonTerminal, Input, Rest)