PLOGHELP ARROW                             Jonathan Laventhol March 1984
                                 Revised by Kathryn Seifert  August 1986

Operator used to specify grammar rules

    <prologterm> --> {<prologterm>}*.

Keywords: grammar rules, grammar, natural language, syntax, symbols,
          operators


The infix operator '-->' is provided to facilitate the expression of
definite clause grammars in Prolog (see PLOGHELP * GRAMMAR_RULE). For
information on the conditional arrow ->, see PLOGHELP * CONDITIONAL.

As an example, if you wanted to express the fact that a sentence can
take the form of a noun phrase followed by a verb phrase, you could
write:

    sentence --> noun_phrase, verb_phrase.

The following expresses that a verb_phrase can be composed of a verb, or
of a verb followed by a noun_phrase:

    verb_phrase --> verb.
    verb_phrase --> verb, noun_phrase.

See PLOGHELP * GRAMMAR_RULE for more details on ways of using this
operator.

Grammar rules expressed in this form are shorthand for normal Prolog
terms.  The built-in predicate 'expand_term/2' takes a grammar rule
written using the '-->' notation as its first argument, and the Prolog
clause equivalent of the grammar rule as its second argument (see
PLOGHELP * EXPAND_TERM).  Here are some examples:

    ?- expand_term((verb_phrase --> verb), X).
    X = verb_phrase(_1, _2) :- verb(_1, _2)
    ?
    yes

    ?- expand_term((sentence(s(NP, VP)) --> np(NP), vp(VP)), X).
    NP = _1
    VP = _2
    X = sentence(s(_1, _2), _3, _4) :- np(_1, _3, _5) , vp(_2, _5, _4)
    ?
    yes


-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * EXPAND_TERM
 Predicate to translate grammar rules into normal Prolog clauses

PLOGHELP * GRAMMARS
 Overview of HELP files dealing with grammars and natural language

PLOGHELP * GRAMMAR_RULE
 Prolog facilities for expressing definite clause grammars
