TYPES OF GRAMMAR
A grammar G is 4-tuple or quadruple G=(V,T,P,S) whereV 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.no | TYPE | NAME | PRODUCTION RULE | RESTRICTION | LANGUAGE GENERATED | MACHINE WHICH RECOGNISES |
---|---|---|---|---|---|---|
1 | Type 0 grammar | Unrestricted grammar | α -> β | No restriction on length of α and β.α cannot be epsilon | type o language or recursively enumerable language | Turing machine |
2 | Type 1 grammar | Context sensitive grammar | α -> β | Length of β must be atleast as much as the length of α | Type 1 language or context sensitive language | Linear Bounded automata |
3 | Type 2 grammar | Context free grammar | A->α | The symbol epsilon can appear on the right side of any production. | type 2 language or context free language | Pushdown automaton |
4 | Type 3 grammar | Regular grammar | A->wB and/or A->w | Regular language | Finite state automaton |
DECEMBER 2006
JUNE 2005
JUNE 2010
32. Which of the following is the most general phase-structure grammar?
A)Regular B)Context-sensitive
C)Context free
D)Syntax tree or D) None of these
Ans:-B
Explanation:- The above question has appeared in more than 3 previous papers. The right answer is Context-sensitive grammar.
DECEMBER 2007
3) A context free grammar is :
A)type 0
B)type 1
C)type 2
Ans:- C
DECEMBER 2009
34). Context free grammar(CFG) can be recognised by
A)Finite state automaton
B)2-way linear bounded automata
C)Push down automata
D)Both B & C
Ans:- C
JUNE 2013 - PAPER III - QNo. 39
Match the following :
a. Context sensitive language i. Deterministic finite automation
b. Regular grammar ii. Recursive enumerable
c. Context free grammar iii. Recursive language
d. Unrestricted grammar iv. Pushdown automation
Ans:-
Unrestricted grammar is Recursive enumerable which is also type 0.
Context free grammar is recognised by pushdown automation
Regular grammar is recognised by Deterministic finite automation
Context sensitive language would be recursive language which is also type 1 grammar.
Choose the appropriate option by looking at the answer.
No comments:
Post a Comment