SlideShare a Scribd company logo
1 of 17
Regular Expression and Regular
languages
 Regular expressions?
 Connection between RE and regular languages
 Regular grammar
 Pumping lemma and non-regular language
grammars
 A regular expression can also be described as a sequence of
pattern that defines a string.
 Regular Expressions are used to denote regular languages.
 The language accepted by FA can be easily described by simple
expressions called Regular Expressions.
 Regular expressions are used to match character combinations in
strings.
 Eg. In a regular expression, x* means zero or more occurrence of
x. It can generate {e, x, xx, xxx, xxxx, .....}
 The languages accepted by some Regular expressions are referred
to as Regular languages.
 A language is regular if it can be expressed in terms of regular
expression.
Eg. L = {a, aa, aaa, ....}
 The various operations on regular language are:
 Union: If L and M are two regular languages then
their union L U M is also a regular language.
 1. L U M = {s | s is in L or s is in M}
 Kleen closure: If L is a regular language then its
Kleen closure L1* will also be a regular language.
 L* = Zero or more occurrence of language L.
Intersection: If L and M are two regular languages then their
intersection is also a regular.
Eg. . L ⋂ M = {st | s is in L and t is in M}
Example1:
Write the regular expression for the language accepting all combinations of
a's, over the set ∑ = {a}
Solution:
 All combinations of a's means a may be zero, single, double and so on. If a
is appearing zero times, that means a null string. That is we expect the set of
{ε, a, aa, aaa, ....}. So we give a regular expression for this as:
 R = a*
Example2:
Write the regular expression for the language accepting all the
string containing any number of a's and b's.
Solution:
The regular expression will be:
r.e. = (a + b)*
L = {ε, a, aa, b, bb, ab, ba, aba, bab, .....}
Example3:
Write the regular expression for the language accepting all
the string which are starting with 1 and ending with 0,
over ∑ = {0, 1}.
Solution:
In a regular expression, the first symbol should be 1,
and the last symbol should be 0.
The r.e. is as follows:
R = 1 (0+1)* 0
Exercise :
1. Write the regular expression for the language
starting and ending with a and having any having any
combination of b's in between.
2. Write the regular expression for the language starting with
a but not having consecutive b's.
3. Write the regular expression for the language accepting all
the string in which any number of a's is followed by any
number of b's is followed by any number of c's.
Regular Expression
Regular Languages
set of vovels ( a ∪ e ∪ i ∪ o ∪ u ) {a, e, i, o, u}
a followed by 0 or more b (a.b*) {a, ab, abb, abbb, abbbb,….}
any no. of vowels followed by any
no. of consonants
v*.c* ( where v – vowels and c –
consonants)
{ ε , a ,aou, aiou, b, abcd…..}
where ε represent empty string
(in case 0 vowels and o
consonants )
Grammar is a finite set of formal rules for generating syntactically correct
sentences or meaningful correct sentences.
A Grammar can contain mainly two elements - Terminal and Non Terminal.
Terminal Symbols
 It is a portion of the sentence generated by using a grammar.
 It is denoted by using small letters, such as a, b, c, d, etc.
Non Terminal Symbols
 It takes part in the formation of a sentence, but not part of it.
 It is denoted by using capital letters, such as A, B, C, D, etc. It is also
called auxiliary symbols.
Grammars denote syntactical rules for conversation in natural
languages.
A grammar is regular if it has rules of form A -> a or A -> aB or A
-> ɛ where ɛ is a special symbol called NULL.
 It is accepted by Finite State Automata.
 The language it generates is called Regular Language.
 Regular languages are closed under operations like Union,
Intersection, Complement etc.
 They are the most restricted form of grammar.
 A grammar G is a 4-tuple
 G = (N,Σ,P,S)
 N or VN is a set of variables or non-terminal symbols.
 T or ∑ is a set of Terminal symbols.
 S is a special variable called the Start symbol, S ∈ N
 P is Production rules for Terminals and Non-terminals.
 A production rule has the form α → β, where α and β are
strings on VN ∪ ∑ and least one symbol of α belongs to VN.
Example
 Grammar G1 −({S, A, B}, {a, b}, S, {S → AB, A → a, B
→ b})
Here,
 S, A, and B are Non-terminal symbols;
 a and b are Terminal symbols
 S is the Start symbol, S ∈ N
 Productions, P : S → AB, A → a, B → b
 Grammar G2 − (({S, A}, {a, b}, S,{S → aAb, aA →
aaAb, A → ε } )
 Here,
 S and A are Non-terminal symbols.
 a and b are Terminal symbols.
 ε is an empty string.
 S is the Start symbol, S ∈ N
 Production P : S → aAb, aA → aaAb, A → ε
 Productions are in the form –
 V –> VT / T (left-linear grammar) (or)
 V –> TV /T (right-linear grammar)
 Example:
 1. S –> ab.
 2. S -> aS | bS | ∊
Ch2 automata.pptx

More Related Content

Similar to Ch2 automata.pptx

Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4shah zeb
 
theory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq pointstheory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq pointsbushraphd2022
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2shah zeb
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler designRiazul Islam
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
Final formal languages
Final formal languagesFinal formal languages
Final formal languagesMegha Khanna
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........NaumanAli215439
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)bolovv
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRaviAr5
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxRaviAr5
 
Handout Regular expression with examples and lecture
Handout Regular expression with examples  and lecture Handout Regular expression with examples  and lecture
Handout Regular expression with examples and lecture mariajan8
 
Context free grammars
Context free grammarsContext free grammars
Context free grammarsRonak Thakkar
 
Specification of Token
Specification of TokenSpecification of Token
Specification of TokenA. S. M. Shafi
 
basics of autometa theory for beginner .
basics of autometa theory for beginner .basics of autometa theory for beginner .
basics of autometa theory for beginner .NivaTripathy1
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01 hamzamughal39
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghggggggggggggggggggggggggggggggggggadugnanegero
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitionsSajid Marwat
 

Similar to Ch2 automata.pptx (20)

Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
theory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq pointstheory of computation notes. introduction and mcq points
theory of computation notes. introduction and mcq points
 
To lec 03
To lec 03To lec 03
To lec 03
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler design
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Final formal languages
Final formal languagesFinal formal languages
Final formal languages
 
Theory of computation
Theory of computationTheory of computation
Theory of computation
 
Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........Theory of Automata ___ Basis ...........
Theory of Automata ___ Basis ...........
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
Handout Regular expression with examples and lecture
Handout Regular expression with examples  and lecture Handout Regular expression with examples  and lecture
Handout Regular expression with examples and lecture
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Specification of Token
Specification of TokenSpecification of Token
Specification of Token
 
basics of autometa theory for beginner .
basics of autometa theory for beginner .basics of autometa theory for beginner .
basics of autometa theory for beginner .
 
Ch02
Ch02Ch02
Ch02
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitions
 

Recently uploaded

Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightDelhi Call girls
 
A level Digipak development Presentation
A level Digipak development PresentationA level Digipak development Presentation
A level Digipak development Presentationamedia6
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...babafaisel
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Roomdivyansh0kumar0
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...Pooja Nehwal
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...Amil baba
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...Call Girls in Nagpur High Profile
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...Suhani Kapoor
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130Suhani Kapoor
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130Suhani Kapoor
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back17lcow074
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CANestorGamez6
 
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,bhuyansuprit
 
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...Suhani Kapoor
 

Recently uploaded (20)

Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
 
A level Digipak development Presentation
A level Digipak development PresentationA level Digipak development Presentation
A level Digipak development Presentation
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
 
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
 
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
 
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
 

Ch2 automata.pptx

  • 1. Regular Expression and Regular languages
  • 2.  Regular expressions?  Connection between RE and regular languages  Regular grammar  Pumping lemma and non-regular language grammars
  • 3.  A regular expression can also be described as a sequence of pattern that defines a string.  Regular Expressions are used to denote regular languages.  The language accepted by FA can be easily described by simple expressions called Regular Expressions.  Regular expressions are used to match character combinations in strings.  Eg. In a regular expression, x* means zero or more occurrence of x. It can generate {e, x, xx, xxx, xxxx, .....}
  • 4.  The languages accepted by some Regular expressions are referred to as Regular languages.  A language is regular if it can be expressed in terms of regular expression. Eg. L = {a, aa, aaa, ....}
  • 5.  The various operations on regular language are:  Union: If L and M are two regular languages then their union L U M is also a regular language.  1. L U M = {s | s is in L or s is in M}  Kleen closure: If L is a regular language then its Kleen closure L1* will also be a regular language.  L* = Zero or more occurrence of language L.
  • 6. Intersection: If L and M are two regular languages then their intersection is also a regular. Eg. . L ⋂ M = {st | s is in L and t is in M} Example1: Write the regular expression for the language accepting all combinations of a's, over the set ∑ = {a} Solution:  All combinations of a's means a may be zero, single, double and so on. If a is appearing zero times, that means a null string. That is we expect the set of {ε, a, aa, aaa, ....}. So we give a regular expression for this as:  R = a*
  • 7. Example2: Write the regular expression for the language accepting all the string containing any number of a's and b's. Solution: The regular expression will be: r.e. = (a + b)* L = {ε, a, aa, b, bb, ab, ba, aba, bab, .....} Example3: Write the regular expression for the language accepting all the string which are starting with 1 and ending with 0, over ∑ = {0, 1}.
  • 8. Solution: In a regular expression, the first symbol should be 1, and the last symbol should be 0. The r.e. is as follows: R = 1 (0+1)* 0 Exercise : 1. Write the regular expression for the language starting and ending with a and having any having any combination of b's in between.
  • 9. 2. Write the regular expression for the language starting with a but not having consecutive b's. 3. Write the regular expression for the language accepting all the string in which any number of a's is followed by any number of b's is followed by any number of c's.
  • 10. Regular Expression Regular Languages set of vovels ( a ∪ e ∪ i ∪ o ∪ u ) {a, e, i, o, u} a followed by 0 or more b (a.b*) {a, ab, abb, abbb, abbbb,….} any no. of vowels followed by any no. of consonants v*.c* ( where v – vowels and c – consonants) { ε , a ,aou, aiou, b, abcd…..} where ε represent empty string (in case 0 vowels and o consonants )
  • 11. Grammar is a finite set of formal rules for generating syntactically correct sentences or meaningful correct sentences. A Grammar can contain mainly two elements - Terminal and Non Terminal. Terminal Symbols  It is a portion of the sentence generated by using a grammar.  It is denoted by using small letters, such as a, b, c, d, etc. Non Terminal Symbols  It takes part in the formation of a sentence, but not part of it.  It is denoted by using capital letters, such as A, B, C, D, etc. It is also called auxiliary symbols.
  • 12. Grammars denote syntactical rules for conversation in natural languages. A grammar is regular if it has rules of form A -> a or A -> aB or A -> ɛ where ɛ is a special symbol called NULL.  It is accepted by Finite State Automata.  The language it generates is called Regular Language.  Regular languages are closed under operations like Union, Intersection, Complement etc.  They are the most restricted form of grammar.
  • 13.  A grammar G is a 4-tuple  G = (N,Σ,P,S)  N or VN is a set of variables or non-terminal symbols.  T or ∑ is a set of Terminal symbols.  S is a special variable called the Start symbol, S ∈ N  P is Production rules for Terminals and Non-terminals.  A production rule has the form α → β, where α and β are strings on VN ∪ ∑ and least one symbol of α belongs to VN.
  • 14. Example  Grammar G1 −({S, A, B}, {a, b}, S, {S → AB, A → a, B → b}) Here,  S, A, and B are Non-terminal symbols;  a and b are Terminal symbols  S is the Start symbol, S ∈ N  Productions, P : S → AB, A → a, B → b
  • 15.  Grammar G2 − (({S, A}, {a, b}, S,{S → aAb, aA → aaAb, A → ε } )  Here,  S and A are Non-terminal symbols.  a and b are Terminal symbols.  ε is an empty string.  S is the Start symbol, S ∈ N  Production P : S → aAb, aA → aaAb, A → ε
  • 16.  Productions are in the form –  V –> VT / T (left-linear grammar) (or)  V –> TV /T (right-linear grammar)  Example:  1. S –> ab.  2. S -> aS | bS | ∊