Logtalk reference manual
Built-in method: phrase/3

phrase/3

Description

phrase(Ruleset, Input, Rest)

True if the list Input can be parsed using the specified non-terminal Ruleset. The list Rest is what remains of the list Input after parsing succeeded.

Template and modes

phrase(+callable, ?list, ?list)

Errors

Ruleset is a variable:
instantiation_error
Ruleset is neither a variable nor a callable term:
type_error(callable, Ruleset)
Input is neither a variable nor a proper list:
type_error(list, Input)
Rest is neither a variable nor a proper list:
type_error(list, Rest)
The predicate Pred corresponding to Ruleset is private:
permission_error(access, private_predicate, Pred)
The predicate Pred corresponding to Ruleset is protected:
permission_error(access, protected_predicate, Pred)
The predicate Pred corresponding to Ruleset is not declared:
existence_error(predicate_declaration, Pred)

Examples

| ?- sentence::phrase(noun_phrase, [the, girl, likes, the, boy], Rest).

Rest = [likes, the, boy]
yes