You are on page 1of 6

FORMAL LANGUAGES AND AUTOMATA THEORY

(FLAT)

U Narasimhulu
Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BHARAT INSTITUTE OF ENGINEERING AND TECHNOLOGY


SYLLABUS

UNIT - II
Regular Expressions: Finite Automata and Regular Expressions, Applications of Regular
Expressions, Algebraic Laws for Regular Expressions, Conversion of Finite Automata to Regular
Expressions.
Pumping Lemma for Regular Languages, Statement of the pumping lemma, Applications of the
Pumping Lemma.
Closure Properties of Regular Languages: Closure properties of Regular languages, Decision
Properties of Regular Languages, Equivalence and Minimization of Automata.
CONTEXT FREE LANGUAGE

In formal language theory, a Context Free Language is a language generated by


some Context Free Grammar.
The set of all CFL is identical to the set of languages accepted by the Pushdown
Automata.

CONTEXT FREE GRAMMAR

Context Free Grammar is defined by 4 tuples as G={V, ⅀, S, P}


Where,
V= Set of Variables or Non-Terminal Symbols
⅀=Set of Terminal Symbols
S=Start Symbol
P=Production Rule

Context Free Grammar has Production Rule of the form,


A α
Where, α ={VU ⅀}* and A ℇ V
Derivations from a Grammar

The set of all strings that can be derived from a Grammar is said to be the
LANGUAGE generated from that Grammar.

Example-1:
For generating a language that generates equal number of a’s and b’s in the form a n bn ,
the CFG will be defined as
G = {(S, A), (a, b), (SaAb, AaAb | ε)}

SaAb

aaAbb (by AaAb)

aaaAbbb (by AaAb)

aaabbb (by Aε)

a3 b3

an bn
L(G) = {an bn | n >0}
Example-2:
G = {(S, A, B), (a, b), (SAB, Aa, Bb)}

SAB
aB (by Aa)
ab (by Bb)

L(G) = {ab}
Example-3:
G = {(S, A, B), (a, b), (SAB, AaA | a, BbB | b)}

Case-1: Case-2:
SAB
aB (by Aa) SAB
ab (by Bb) aB (by Aa)
abB (by BbB)
abb (by Bb)

Case-3: Case-4:

SAB SAB
aAB (AaA) aAB (by AaA)
aAb (Bb) aAbB (by BbB)
aab (Aa) aabB (by Aa)
aabb (by Bb)

L(G) = {am bn | m>0, n>0}

You might also like