Compiler
Compiler
Compiler
name:priyanka manna
roll no:12000121056
PAPER NAME : compiler design
paper code : pcc-cs 501
SEMESTER: 5th sem
ARDEN’S THEOREM
Let P and Q be two regular expression.P does not contain λ then the following equation
in R that is R= Q + RP has a unique solution given by R = QP*
PROPERTIES FOR REGULAR EXPRESSION
Union:
Let L and M be the languages of regular expressions R and S, respectively.Then R+S is a
regular expression whose language is(L U M).
Intersection:
Let L and M be the languages of regular expressions R and S, respectively then it is a regular
expression whose language is (L ∩ M).
Kleene Closure:
R, S is a regular expression whose language is L, M. R* is a regular expression whose
language is L*.
Positive Closure:
R,S is a regular expression whose language is L, M.R+ is a regular expression whose language
is L+.
Complement:
The complement of regular expression is also regular expression.
REGULAR EXPRESSION to nfa
An NDFA is represented by digraphs called state diagram
•The vertices represent the states.
• The arcs labeled with an input alphabet show the transitions.
• The initial state is denoted by an empty single incoming arc.
• The final state is indicated by double circles.
Example:1
Design a NFA from given regular expression (ab)*ab*
Step 1:
ab b
q0 a qf
Step 2:
q1
a b
b
q0 a qf
Example:2
Design a NFA from given regular expression (a+ba)*ba
Step 1:
a+ba
b a
q0 q1 qf
Step 2:
a
b a qf
q0 q1
ba
Step 3:
a
q0 b a qf
q1
a
b
q2
conclusion
Regular expressions are a compact textual representation of a set of
strings representing a language.Regular expressions appeared as
Type-3 languages in Chomsky’s hierarchy.The class of regular
languages is a proper subset of the context-free languages.Any
Regular expression can be automatically compiled into an NFA,to a
DFA, and to a unique minimum-state DFA.