A definite clause grammar (DCG) is a way of expressing grammar, either for natural or formal languages, in a logic programming language such as Prolog. It is closely related to the concept of attribute grammars / affix grammars from which Prolog was originally developed. DCGs are usually associated with Prolog, but similar languages such as Mercury also include DCGs. They are called definite clause grammars because they represent a grammar as a set of definite clauses in first-order logic.
The term DCG refers to the specific type of expression in Prolog and other similar languages; not all ways of expressing grammars using definite clauses are considered DCGs. However, all of the capabilities or properties of DCGs will be the same for any grammar that is represented with definite clauses in essentially the same way as in Prolog.
The definite clauses of a DCG can be considered a set of axioms where the validity of a sentence, and the fact that it has a certain parse tree can be considered theorems that follow from these axioms. This has the advantage of making it so that recognition and parsing of expressions in a language becomes a general matter of proving statements, such as statements in a logic programming language.
Read more about Definite Clause Grammar: History, Extensions, Example, Translation Into Definite Clauses, Non-context-free Grammars, Representing Features, Parsing With DCGs, Other Uses
Famous quotes containing the words definite, clause and/or grammar:
“The fact that a man is to vote forces him to think. You may preach to a congregation by the year and not affect its thought because it is not called upon for definite action. But throw your subject into a campaign and it becomes a challenge.”
—John Jay Chapman (18621933)
“Long ago I added to the true old adage of What is everybodys business is nobodys business, another clause which, I think, more than any other principle has served to influence my actions in life. That is, What is nobodys business is my business.”
—Clara Barton (18211912)
“Proverbs, words, and grammar inflections convey the public sense with more purity and precision, than the wisest individual.”
—Ralph Waldo Emerson (18031882)