Thursday, April 30, 2015

TYPES OF GRAMMAR

A grammar G is 4-tuple or quadruple G=(V,T,P,S) where 

V is set of variables or non-terminals.
T is set of terminals.
P is set of productions.
S is the start symbol.
Each production is of the form α -> β where α is a non empty string of terminals and/or non-terminals and β is string of terminals and/or non-terminals including the null string. This grammar is also called as phase-structure grammar.

CHOMSKY HIERARCHY

Phase-structure grammars may be classified according to their productions. The following table would help you understand with the classifications.
S.noTYPENAMEPRODUCTION RULERESTRICTIONLANGUAGE GENERATEDMACHINE WHICH RECOGNISES
1Type 0 grammarUnrestricted grammarα -> βNo restriction on length of α and β.α cannot be epsilontype o language or recursively enumerable languageTuring machine
2Type 1 grammarContext sensitive grammarα -> βLength of β must be atleast as much as the length of αType 1 language or context sensitive languageLinear Bounded automata
3Type 2 grammarContext free grammarA->αThe symbol epsilon can appear on the right side of any production.type 2 language or context free languagePushdown automaton
4Type 3 grammarRegular grammarA->wB and/or A->wRegular languageFinite state automaton

No comments:

Post a Comment