Regular Grammar: Bachelor of Technology Computer Science and Engineering
Regular Grammar: Bachelor of Technology Computer Science and Engineering
Bachelor of Technology
Computer Science and Engineering
Submitted By
MAY 2019
Techno India
EM-4/1, Sector-V, Salt Lake
Kolkata- 700091
West Bengal
India
TABLE OF CONTENTS
1. Introduction
2. Body
i. Regular Grammars
3. References
1. Introduction:
Examples
An example of a right regular grammar G with N = {S, A}, Σ = {a, b, c}, P consists of the
following rules
S → aS
S → bA
A→ε
A → cA
and S is the start symbol. This grammar describes the same language as the regular
expression a*bc*, viz. the set of all strings consisting of arbitrarily many "a"s, followed by a
single "b", followed by arbitrarily many "c"s.A somewhat longer but more explicit extended
right regular grammar G for the same regular expression is given by N = {S, A, B, C}, Σ = {a, b,
c}, where P consists of the following rules:
S→A
A → aA
A→B
B → bC
C→ε
C → cC
…where each uppercase letter corresponds to phrases starting at the next position in the regular
expression.As an example from the area of programming languages, the set of all strings
denoting a floating point number can be described by an extended right regular
grammar G with N = {S, A,B,C,D,E,F}, Σ = {0,1,2,3,4,5,6,7,8,9,+,-,.,e}, where S is the start
symbol, and P consists of the
following rules:
S → +A A → 0A B → 0C C → 0C D → +E E → 0F F → 0F
S → -A A → 1A B → 1C C → 1C D → -E E → 1F F → 1F
S→A A → 2A B → 2C C → 2C D→E E → 2F F → 2F
A → 3A B → 3C C → 3C E → 3F F → 3F
A → 4A B → 4C C → 4C E → 4F F → 4F
A → 5A B → 5C C → 5C E → 5F F → 5F
A → 6A B → 6C C → 6C E → 6F F → 6F
A → 7A B → 7C C → 7C E → 7F F → 7F
A → 8A B → 8C C → 8C E → 8F F → 8F
A → 9A B → 9C C → 9C E → 9F F → 9F
A → .B C → eD F→ε
A→B C→ε
I. Regular Grammars
A regular grammar G is a quadruple (V, , R, S), where:
X Y,
● , or
● a single terminal, or
Legal: S a, S , and T aS
S
S aT
S bT
Ta
Tb
T aS
T bS
III. Regular Languages and Regular Grammars
Theorem: The class of languages that can be defined with regular grammars is exactly
the regular languages.
Proof: By two constructions.
S Ta
S aT Tb
S bT T aS
T bS
S A bA C aC
S aB A cA C bC
S aC A C
S bA B aB
S bC B cB
S cA B
S cB
2. References:
https://en.wikipedia.org/wiki/Regular_grammar
https://www.tutorialspoint.com/automata_theory/introduction_to_grammars.htm
https://www.tutorialspoint.com/automata_theory/regular_expressions.htm
https://www.geeksforgeeks.org/regular-expressions-regular-grammar-and-regular-languages/
https://www.cs.montana.edu/ross/theory/contents/chapter02/green/section05/page04.xhtml
http://www.montefiore.ulg.ac.be/~pw/cours/psfiles/calc-chap3.pdf
https://ocw.mit.edu/ans7870/6/6.005/s16/classes/17-regex-grammars/
https://www.sanfoundry.com/automata-theory-regular-grammars/