Nonterminal symbol

from Wikipedia, the free encyclopedia

A non-terminal symbol (also non-terminal , Nonterminalsymbol or variable called) a formal grammar is a symbol that is not in the final words occur, which can be generated in the grammar. Non-terminal symbols only occur in intermediate steps of a derivation and are gradually replaced by applying rules in the grammar until only terminal symbols are left.

definition

For a formal grammar, denotes the set of nonterminal symbols. It is opposed to the multitude of terminal symbols. The set of production rules describes how non-terminal symbols can be replaced by new strings. The start symbol can be derived from which all words, one of the non-terminal symbols: .

Non-terminals are often written as capital letters or, for example in the Backus-Naur form , enclosed in angle brackets.

Examples

The grammar

.

generates the language of all a, b, c - palindromes , for example or . It only needs one non-terminal symbol, namely .

The palindrome can be derived in that the nonterminal symbol is first replaced with, the existing symbol with , with the result . This is removed by replacing it with the empty word so that one obtains.

A derivation tree for the palindrome contains the terminal symbols in the leaves and as roots and inner nodes.

Syntax trees in linguistics , which represent the grammatical structure of a sentence, contain the words of the sentence as terminal symbols and the grammatical constituents as nonterminals . A sentence often consists of a noun phrase and a verb phrase . Verb phrases can in turn consist of a verb and another noun phrase, for example. Noun phrases can, for example, be nouns with or without a preceding article. Sentence , noun phrase , verb phrase , verb , noun and item are the non-terminal symbols here.

literature