Compiler
Compiler
States : A,B,C
Start state : A
Sfds
Final term
st
1 class : 09/10/2021
Recursive grammer are two type:
1.left
2.Right
Lift recursive:
A Aα/ β
Start symbole A
লেফট রিকার্শন হওয়ার কারনঃ স্টাট সিমভ্ল যদি সেইম হয়। A ->
Aα/ β (because of A )
A -> βα* (regular expression)
A()
{
A()
B base case
}
Right recursive
A αA/β
A ->α*β(regular expression)
A()
{
B base case
A()
}
Elimination left recursion:
A Aα/ β
For this grammar, regular expression is : A βα*
We want eliminate left recursive. For this We had to
make new grammar using regular expression.
So,
A βα*
(βα* means: β, βα, βαα……..
new grammar:
A βA’
A’ ε/α*
If we want to make regular expression using this
grammar it will make same.
A βα* As A’ ε/α*
Find left factoring
S α/αβ1/ αβ2/ αβ3
In this grammar, if we want get S αβ3
What will happen,
Microprocessor lab
Compiler
Python
Lexical analysis