We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9
Classification of languages
By: Mrs. Swati Jaipurkar,
Asst. Prof, CSED, MIT,Aurangabad. • Chomsky Hierarchy represents the class of languages that Introduction are accepted by the different machine. • The category of language in Chomsky's Hierarchy is as follows: • Type 0 known as Type 0 known as unrestricted grammar. • Type 1 known as context sensitive grammar. • Type 2 known as context free grammar. • Type 3 Regular Grammar. Continued..... • formal grammar consists of a finite set of production rules ( left-hand side → right- hand side), • where each side consists of a finite sequence of the following symbols: • a finite set of nonterminal symbols (indicating that some production rule can yet be applied) • a finite set of terminal symbols (indicating that no production rule can be applied) • a start symbol (a distinguished nonterminal symbol) • A formal grammar provides an axiom schema for (or generates) a formal language, • A sequence of rule applications is called a derivation. • Such a grammar defines the formal language: all words consisting solely of terminal symbols which can be reached by a derivation from the start symbol. Types of grammar Type Grammar Language Automaton • According to Noam Chomosky, there are Accepted Accepted four types of grammars − Type 0, Type 1, Type 2, and Type 3. The following table Type 0 Unrestricted Recursively Turing grammar enumerable Machine shows how they differ from each other − language Type 1 Context- Context- Linear- sensitive sensitive bounded grammar language automaton Type 2 Context-free Context-free Pushdown grammar language automaton Type 3 Regular Regular Finite state grammar language automaton 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 productions must be in the form X → a or X → aY • where X, Y ∈ N (Non terminal) • and a ∈ T (Terminal) • The rule S → ε is allowed if S does not appear on the right side of any rule. • Example • X → ε X → a | aY Y → b Type-2 grammars • Type-2 grammars generate context-free languages. • The productions must be in the form A → γ • where A ∈ N (Non terminal) • and γ ∈ (T ∪ N)* (String of terminals and non-terminals). • These languages generated by these grammars are be recognized by a non-deterministic pushdown automaton. • Example • S → X a X → a X → aX X → abc X → ε Type - 1 Grammar • Type-1 grammars generate context-sensitive languages. The productions must be in the form • αAβ→αγβ • where A ∈ N (Non-terminal) • and α, β, γ ∈ (T ∪ N)* (Strings of terminals and non-terminals) • The strings α and β may be empty, but γ must be non-empty. • The rule S → ε is allowed if S does not appear on the right side of any rule. The languages generated by these grammars are recognized by a linear bounded automaton. • Example • AB → AbBc A → bcA B → b Type - 0 Grammar Type-0 grammars Type-0 grammars generate recursively enumerable languages. The productions have no restrictions. They are any phase structure grammar including all formal grammars. They generate the languages that are recognized by a Turing machine. The productions can be in the form of α → β where α is a string of terminals and non- terminals with at least one non-terminal and α cannot be null. β is a string of terminals and non-terminals. Example S → ACaB Bc → acB CB → DB aD → Db