0% found this document useful (0 votes)
126 views29 pages

Theory of Automata: by Arjun Singh

The document discusses various topics related to formal languages and automata theory including: - Context free grammars defined by four tuples including variables, terminals, productions, and start symbol. Derivations and derivation trees are discussed. - Pushdown automata including nondeterministic and deterministic models. Properties of context free languages like closure properties and the pumping lemma. - Turing machines including basic models and modifications. Turing machines as computers of integer functions and the universal Turing machine. The halting problem and recursive function theory. - Ambiguity in grammars where more than one derivation or parse tree is possible for an input string. - Left linear and right linear grammars and how to

Uploaded by

Lakshita Sejwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views29 pages

Theory of Automata: by Arjun Singh

The document discusses various topics related to formal languages and automata theory including: - Context free grammars defined by four tuples including variables, terminals, productions, and start symbol. Derivations and derivation trees are discussed. - Pushdown automata including nondeterministic and deterministic models. Properties of context free languages like closure properties and the pumping lemma. - Turing machines including basic models and modifications. Turing machines as computers of integer functions and the universal Turing machine. The halting problem and recursive function theory. - Ambiguity in grammars where more than one derivation or parse tree is possible for an input string. - Left linear and right linear grammars and how to

Uploaded by

Lakshita Sejwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Theory of Automata

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:

CFG stand for context free grammar. Context free grammar is a


formal grammar which is used to generate all possible patterns of strings in
a given formal language.

Context free grammar g can be defined by four tuples.

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.

V= set of variables or none terminal symbol.It is denoted by capital letters.

T=set of terminal symbol ,it is denoted by lower case letter


P is a production rule for terminal and
none –terminal which is used for
replacing none terminal symbol(on left
side production) in string with other
terminals or none – terminal symbol(righ
side of production)
V={A,B,C,D}
T={a,b,c,….+,-,*,/}

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.

Following property of parse tree:

*The root node is always a node indicating start symbols.


*The derivation is read from left to right.
*The leaf node is always terminal nodes.
*The interior nodes are always the non-terminal nodes.
*Parse tree follows the precedence of operators

*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 design.
*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

since two parse tree for single string so ambiguous


Left Linear grammar and Right linear grammar :
If all production are in the form of A ->Bα or A ->α where A,B € V and
α € ∑* then the grammar is called left linear grammar.

Example :
A -> Aa|Bb|b

Right Linear Grammar:

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
Left linear Grammar to FA

S -> Ca|Aa|Bb
A -> Ab|Ca|Bb|a
B -> Bb|b
C -> Aa
solution :LLG ---reverse----- > RLG
S -> aC|aA|bB
A ->bA|aC|bB|a
B -> bB|b
C -> aA
Right linear grammar construct a DFA that accept the language generated
by the grammar
S -> abA
A -> baB
B ->aA|bb
Reverse
Thanks

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy