Production rule

from Wikipedia, the free encyclopedia

A production rule (also called rule , production or replacement rule ) is in the theory of formal grammars a rule that specifies how new words or symbol sequences are produced from words through a grammar .

definition

Formally, a production rule of a grammar - with vocabulary , alphabet of terminal symbols , rule set and start symbol - an element of the set of rules, that is .

A rule is an ordered pair of the two words and when one word is off and one word is off. The word can therefore be any length of sequence of characters in the vocabulary ( is the Kleen's envelope of ), as long as it is not empty and does not only consist of terminal symbols . It is therefore . According to the rule, the word can then replace the word and can be any long, finite sequence of characters in the vocabulary. In particular, it can only consist of terminal symbols ( ) or the empty word ( ). The production rules thus represent a finite subset of the Cartesian quantity product

,

thus represents a relation . If one also demands that no start characters may appear on the right side of a rule, then in the above Cartesian product the right side has to appear instead .

A rule is often represented by its notation (with the relational symbol instead of ), and the set of associated rules for each fixed can be abbreviated by the notation .

Application of production rules

In theoretical computer science and in linguistics , the production rules of a formal grammar are used to describe or create formal languages.

Is a word before, this can be a production rule to apply, with the resulting word . A word that consists only of terminal symbols and can be derived from the start symbol is a word of the language that is described by the grammar.

Examples

Let the production rule be defined within a formal grammar with the non-terminal symbols and the terminal symbols . By applying this rule, when generating the language described by the grammar, for example, the word can be derived from the word , with the prefix being replaced by the conclusion . However, according to the definition of formal grammars, it would also be possible to replace the second occurrence of the word so that the word arises.

If the rule were also defined, the previously considered word could also be derived into the words or . ( is the usually used notation for the empty word , a word that does not consist of a single character.)

Computer science

As already described, production rules are a fundamental part of formal grammars and are therefore used to describe formal languages. Production rules are used, for example, in the context of compiler construction to describe a programming language . Production rules are often presented here in the Backus-Naur form .

Production rules have a cognitive application in rule-based systems : Here one speaks of production rules if the conclusions of the rules with which the system works consist only of conjunctions of literals.

linguistics

In the theory of transformation grammar , production rules , which are called phrase structure rules ( PS rule n) here, illustrate the idea that a sentence has a grammatical structure that is built up recursively from category-bearing components . The first and classic PS rules in Chomsky's book "Structures of Syntax" are:

S → NP VP (ein Satz besteht aus einer Nominalphrase und einer Verbalphrase)
VP → V NP* (eine Verbalphrase besteht aus einem Verb und null bis vielen Nominalphrasen)

Notes and individual references

  1. The members of the crowd are referred to as non-terminal characters , to which the start character belongs, that is .
  2. ^ Analogous to Klaus Reinhardt: Priority payer machines and the synchronization of half-track languages , Faculty of Computer Science at the University of Stuttgart; PhD thesis 1994
  3. Compare the Backus-Naur form .

Web links

Wiktionary: phrase structure rule  - explanations of meanings, word origins, synonyms, translations