Professional Documents
Culture Documents
Theory of Automata: by Arjun Singh
Theory of Automata: by Arjun Singh
By
Arjun Singh
Unit 3:
Regular and Non-Regular Grammars: Context Free Grammar(CFG)-Definition, Derivations,
Languages, Derivation Trees and Ambiguity, Regular Grammars-Right Linear and Left Linear
grammars, Conversion of FA into CFG and Regular grammar into FA, Simplification of CFG,
Normal Forms- Chomsky Normal Form(CNF), Greibach Normal Form (GNF), Chomsky
Hierarchy, Programming problems based on the properties of CFGs.
Unit 4
Push Down Automata and Properties of Context Free Languages: Nondeterministic
Pushdown Automata (NPDA)- Definition, Moves, A Language Accepted by NPDA,
Deterministic Pushdown Automata(DPDA) and Deterministic Context free Languages(DCFL),
Pushdown Automata for Context Free Languages, Context Free grammars for Pushdown
Automata, Two stack Pushdown Automata, Pumping Lemma for CFL, Closure properties of
CFL, Decision Problems of CFL, Programming problems based on the properties of CFLs.
Unit -5
Turing Machines and Recursive Function Theory : Basic Turing Machine Model, Representation of
Turing Machines, Language Acceptability of Turing Machines, Techniques for Turing Machine
Construction, Modifications of Turing Machine, Turing Machine as Computer of Integer Functions,
Universal Turing machine, Linear Bounded Automata, Church’s Thesis, Recursive and Recursively
Enumerable language, Halting Problem, Post’s Correspondance Problem, Introduction to Recursive
Function Theory.
Context Free Grammar:
G=(V,T,P,S) or (N,T,P,S)
G=G is a grammar which consist of a set of production rule. It is used to
generate the string of language.
D=D+D
C=AS
B=b/a
A=aa
Derivation :
Derive the string “abb”for left most
derivation and right most derivation using cfg
given by
S-> AB/E
A->aB
B->Sb
Left most derivation
S
AB S->AB
aBB A->aB
aSbB B->Sb
abB S->E
abSb B->Sb
abb S->E
Right most derivation
S
AB S->AB
Asb B->sb
AEb S->E
aBb A->aB
aSbb B->Sb
abb S->E
Derivation Tree:
Derivation tree is a graphical representation for the derivation of the
given production rules . The derivation tree is also called a parse tree.
*The deepest subtree travel first . So the operator in the parent node has
less precedence , over the operation in subtree.
*
G={V,T,P,S}
where S->0B , A->1AA/£ ,
B->0AA
Example: production rule
E=E+E
E=E*E
E=a/b/c Input :a*b+c
Step 1
a*b+c
Ambiguity In Grammar :
*more than one left most derivation
* more than one right most derivation
* more than one parse tree for given i/P string
* if the grammar is not ambiguous then we call
unambiguous
* if the grammar has ambiguity then it is not
good for compiler construction.
*No method can automatically detect and remove the ambiguity.
Lets consider a grammar with production rule
E -> I
E ->E+E
E ->E*E
E ->(E )
E -> €/0/1/2/….9
G={V,T,P,S}
V={I,E}
T={+,*,(),€,0,1,2….9}
For the string 3*4+5
Example :
A -> Aa|Bb|b
If all production are in the form of A ->αB or A ->α where A,B € V and
α € ∑* then the grammar is called Rght linear grammar.
Example:
A ->aA|bB|b
Given grammar :
S ->0A|1B|0 right linear grammar
convert to finite automata
S ->0A
S ->1B
Chomsky Normal Form(CNF):
CNF stand for Chomsky normal form. A cfg is in cnf if all production
rule satisfy one of the following
* A start symbol generating €
example : A -> €
*If the grammar remove the null, unit and useless production
* Eliminate the terminal for RHS of the production if they exist with other
none terminals or terminals
S -> RS
R -> AB
https://www.youtube.com/watch?v=XnteU4oGMuY
productions are of the form
A -> BC
or
A->a
where A,B,C € V and a € T
S - > AS|a
A -> SA|b is in cnf
S -> AS|AAS
A -> SA|aa
Thanks