Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The third kind of grammar of formal grammar
The third kind of grammar of formal grammar
Three types of grammars are also called normal grammars, which correspond to finite state automata. Normal grammar has many equivalent definitions. We can use left linear grammar or right linear grammar to define normal grammar equivalently. The left linear grammar requires that the left side of the production can only contain a non-terminator, and the right side of the production can only be an empty string, a terminator or a non-terminator followed by a terminator. Right linear grammar requires that the left side of production can only contain a non-terminator, and the right side of production can only be an empty string, a terminator or a terminator followed by a non-terminator. On the basis of type 2 grammar, it is satisfied that: A→α|αB (right linear) or A→α|Bα (left linear).

If yes: a-> Answer, answer-> aB,B-& gt; a,B-& gt; CB, which meets the requirements of Class 3 grammar. But if it is deduced as: a->; ab,A-& gt; aB,B-& gt; a,B-& gt; CB or deduced as: a-> Answer, answer-> Ba,B-& gt; a,B-& gt; CB does not meet the requirements of type 3 method. Specifically, case a->; ab,A-& gt; aB,B-& gt; a,B-& gt; A-> a in cB; Ab does not conform to the definition of type 3 grammar, so the following ab should be changed to "a non-terminator+a terminator" (that is, aB). Example a->; Answer, answer-> Ba,B-& gt; a,B-& gt; If b->; CB changed to B-> The form of Bc is correct, because two sets of rules, A→α|αB (right linear) and A→α|Bα (left linear), cannot appear in a grammar at the same time, and only one of them can be completely satisfied, which can be regarded as a type 3 grammar.

Note: In the above example, capital letters represent non-terminators and lowercase letters represent terminators.