COMPUTER SCIENCE AND ENGINEERING
THEORY OF COMPUTATION
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
type 0
|
|
type 1
|
|
type 2
|
|
type 3
|
Detailed explanation-1: -Type-2 grammars generate the context-free languages. These are defined by rules of the form A → with A a nonterminal and a string of terminals and nonterminals. These languages are exactly all languages that can be recognized by a non-deterministic pushdown automaton.
Detailed explanation-2: -According to Chomsky hierarchy, grammar is divided into 4 types as follows: Type 0 is known as unrestricted grammar. Type 1 is known as context-sensitive grammar. Type 2 is known as a context-free grammar.
Detailed explanation-3: -A context-free grammar is a set of recursive rules used to generate patterns of strings. A context-free grammar can describe all regular languages and more, but they cannot describe all possible languages. Context-free grammars are studied in fields of theoretical computer science, compiler design, and linguistics.
Detailed explanation-4: -Type 1 known as Context Sensitive Grammar. Type 2 known as Context Free Grammar. Type 3 Regular Grammar.
Detailed explanation-5: -Type-3 Grammar Type-3 grammars generate regular languages. Type-3 grammars must have a single non-terminal on the left-hand side and a right-hand side consisting of a single terminal or single terminal followed by a single non-terminal. The rule S → is allowed if S does not appear on the right side of any rule.