Four simple distinction between software structure grammar

grammar

Grammar G is defined as a four-tuple (VN, VT, P, S)

VN: nonterminal set is usually represented by uppercase letters
VT: terminator set is usually represented by lower case letters
P: set of production (rule set)
S: start symbol (identification code)

Tip: The following examples are non-capital letters terminators, and lower case letters represents the terminator.
1.0 type grammar (phrase)
set G = (VN, VT, P , S), if each of its production α → β is a structure: α∈ (VN∪VT) * and containing at least one non- terminator, and β∈ (VN∪VT) *, then G is a 0-type grammar. Type 0 grammar is these types of grammar, the least restrictive one, so we have seen in the papers, at least 0-type grammar.
0 corresponds to a Turing machine type grammar.
2. Type 1 grammars (context-sensitive grammar)

It is based on the grammar 0 each type α → β, there | β |> = | α | . Here | beta] | beta] represents the length.
Type 1 corresponds grammar linear bounded automaton.
Examples: If A-> Ba is | β | = 2, | α | = 1 meet the requirements of Type 1 grammar. Conversely, if aA-> a, not in line with type 1 grammar.
Specific examples: α → ε satisfies type 1 grammar.
Type 3.2 grammar (CFG)
type 2 grammar type is based on a grammar, then satisfied: α → β each have [alpha] is a nonterminal symbol. The A-> Ba, meet the requirements of type 2 grammar.
Corresponds to type 2 grammar pushdown automata.
Examples: Ab-> Bab though in line type grammar in claim 1, but not with type 2 grammar requirements, since it α = Ab, Ab rather than a nonterminal. A-> Bab on to it
4.3 grammar type (regular grammar)
which satisfy the grammar on the basis of type 2: A → α | αB (right-linear) or A → α | Bα (left linear).
Type 3 grammar corresponding to finite state automaton.
Note: type 3 grammar only meet the right linear, or can meet the linear left, are not both at the same
example: A-> a, A-> aB , B-> a, B-> cB, in line with the 3 type grammar requirements. However, if the derived as: A-> ab, A-> aB , B-> a, B-> cB or derived      
as: A-> a, A-> Ba , B-> a, B-> cB not meet the method of claims 3 type.
https://blog.csdn.net/songsong189/article/details/48768819

Guess you like

Origin www.cnblogs.com/xuange1/p/11919196.html