CS402 (Formal Language and Automata Theory) : Chomsky Classification of Grammar
CS402 (Formal Language and Automata Theory) : Chomsky Classification of Grammar
Presented By:
NAME: PUNEET AGARWAL
ROLL NO: 13000117076
STREAM: CSE (A)
SEM: 4th
YEAR: 2019
INTRODUCTION
Formal Grammars
A formal grammar of this type 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 symbol (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, which is a (usually infinite) set
of finite-length sequences of symbols that may be constructed by applying production rules to another sequence of
symbols (which initially contains just the start symbol). A rule may be applied by replacing an occurrence of the symbols
on its left-hand side with those that appear on its right-hand side. 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.
Non-terminals are often represented by uppercase letters, terminals by lowercase letters, and the start symbol by S. For
example, the grammar with terminals {a, b}, non-terminals {S, A, B}, production rules
S → AB
S → ε (where ε is the empty string)
A → aS
B→b
The following is a simpler grammar that defines the same language: Terminals {a, b}, Non-terminals {S}, Start symbol S,
Production rules
S → aSb
S→ε
Formal Language
Production rules
SENTENCE → NOUNPHRASE VERBPHRASE
NOUNPHRASE → ADJ NOUNPHRASE
NOUNPHRASE → NOUN
VERBPHRASE → VERB NOUNPHRASE
VERBPHRASE → VERB
The Hierarchy
Recursively
Type-0 Turing machine
enumerable
Type-0 grammars
Type-0 grammars include all formal grammars. They generate exactly all
languages that can be recognized by a Turing machine. These languages are
also known as the recursively enumerable or Turing-recognizable languages. Note
that this is different from the recursive languages, which can be decided by
an always-halting Turing machine.
Type-1 grammars
Type-1 grammars generate context-sensitive languages. These grammars have
rules of form with non-terminals. The rule is allowed if {\displaystyle S}does not
appear on the right side of any rule. The languages described by these grammars
are exactly all languages that can be recognized by a linear bounded
automation (a nondeterministic Turing machine whose tape is bounded by a
constant times the length of the input.)
Type-2 grammars
Type-2 grammars generate the context-free languages. These are defined by
rules of the form with being a nonterminal and being a string of terminals and/or
non-terminals. These languages are exactly all languages that can be
recognized by a non-deterministic pushdown automaton.
Type-3 grammars
Type-3 grammars generate the regular languages. Such a grammar restricts its
rules to a single nonterminal on the left-hand side and a right-hand side consisting
of a single terminal, possibly followed by a single nonterminal (right regular).
Alternatively, the right-hand side of the grammar can consist of a single terminal,
possibly preceded by a single nonterminal (left regular). These generate the same
languages.
CONCLUSION
https://www.tutorialspoint.com/ChomskyClassificationOfGram
mer
Class notes
Theory of Computer Science by K.L.P. Mishra and N.
Chandrasekaran
https://en.m.wikipedia.org/wiki/ChomskyHierarchy
THANK YOU