0% found this document useful (0 votes)
2 views4 pages

Chapter 3 automata

This document discusses regular grammars, defining their structure and providing examples of valid and invalid grammars. It also explains the concept of regular languages generated by these grammars and includes construction methods for λ-free regular grammars. Additionally, it presents theorems related to the properties of regular languages, such as closure under union and concatenation.

Uploaded by

Robel
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
2 views4 pages

Chapter 3 automata

This document discusses regular grammars, defining their structure and providing examples of valid and invalid grammars. It also explains the concept of regular languages generated by these grammars and includes construction methods for λ-free regular grammars. Additionally, it presents theorems related to the properties of regular languages, such as closure under union and concatenation.

Uploaded by

Robel
Copyright
© © All Rights Reserved
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/ 4

MicroLink Information Technology College

Chapter Three
Regular Grammars

Regular Grammar
Definition:
A PSG G = ( N, T, P, S) is called a regular grammars provided that
i. If there is a λ-production in G then it is of the form S → λ and then S does not appear on the
right hand side of any production in P.
ii. All other production in P are:
A → a, A Є N, a Є T OR
A → aB, a Є T, B Є N
Examples:
Which of the following are regular grammars?
a) S → a | aB
b) S → aS | λ
c) S → AA | aS
A → aA | B
d) S → a | Sa | λ
e) S → a | aA | λ
A→b
Solutions:
Only a and e are regular grammar
Regular Language
Let G = ( N, T, P, S) be a regular grammar. The language generated by G denoted L(G) is called a
regular language.
Example:
Find the language generated by the following regular grammar.
S → bS | bA
A → aA | a
Solution:

Introduction to Formal Language and Automata Page 1


MicroLink Information Technology College

S → bA S → bA S → bS
S → ba S → b aA S → b bS
S → ba aA S → bb bS
S → ba , , , , aA S → bb , , , , , b bA
S → bb , , , , , b baaa , , , , a
L(G) = {bman | m, n > 1}

Construction λ-free regular Grammar

Let LL = L2
LL2 =L3

L(G)+ G = ( N, T, P, S) L(G)
G+ = (N, T, P+, S) L(G)+
Let G = (N, T, P, S) be λ-free regular grammar construct G+ = (N, T, P+, S) a λ-free grammar such that
L(G)+ is a language generated by G+ [ L(G+) = L(G)+ ]
Construction:
P+ = P U {α → βS for every α → β Э β Є T}
Example:
Let G be a λ-free regular with production
S → bS | bA
A → aA | a
Construct G+ and find L(G)+
Solution:
G+ = ( N, T, P+, S) with
P+ : S → bS | bA
A → aA | a | aS
L(G)+ = { (bman)k | n, m k > 1}
Let G1 = (N1, T1, P1, S1) be a regular grammar with productions:
S1 → bS1 | bA
A → aA | a
L1 = L(G1) = {bman | n, m > 1}

Introduction to Formal Language and Automata Page 2


MicroLink Information Technology College

Let G2 = (N2, T2, P2, S2) with productions


S2 → CS2 | c
L2 = L(G2) = {cn | n > 1}
Find G3 for every
a) L3 = L(G3) = L1 U L2 and
b) L3 = L(G3) = L1L2
Solution:
a) Let G3 = (N3, T3, P3, S3)
N3 = N1 U N2 U { S3 }
T3 = T1 U T2
P3 consist of:
S3 → S1 | S2 ( This is not regular grammar)
So P3 = P1 U P2 U P where P consist of productions
S3 → α Є P1 or
S3 → α Є P2
P3: S3 → bS1 | bA | cS2 | c ----------------- P
S1 → bS1 | bA P1
A → aA | a
S2 → c | cS2 P2

L3 = L(G3) = {bman | m, n > 1} U {cn | n > 1}


= L1 U L2
= L(G1) U L(G2)
b) Let G3 = (N3, T3, P3, S1)
N3 = N1 U N2
T3 = T1 U T2
P3 = P1 U P2 U P where P consists of production
A → aS2 where A → a Є P1
Thus P3:
S1 → bS1 | bA
A → aA | aS2
S2 → cS2 | c
L3 = L(G3) = {bmanck | m, n, k > 1} = L1L2
Introduction to Formal Language and Automata Page 3
MicroLink Information Technology College

Theorems:

a) If L1 and L2 are regular language so are L1 U L2 and L1L2


b) If L is a regular language so is L*

Introduction to Formal Language and Automata Page 4

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