Regular expression to NFA-confusing regular expressions-:

shivajikobardan

Junior Member
Joined
Nov 1, 2021
Messages
107
R=(01+010)*
For it I made the below nfa which i believe seems correct. Plus the tutorials that I am following also make sure it’s correct. Q0 is initial state(forgot to mention in figure).
GUZlDA7_UjNWlcNx76e1xHOYhNjYBzbDMnP9qBnMjL8ux_Ntz3SSVIcw-VfMR6jbFlbxYG3nx6ccd2gWObG2hXnmXLE14mKI4PtFf4GtDc_PgenECvC_h_m9Yrbrg99hHZh258F9


R=(01)*+(010)*

But idk how to convert this to NFA
What will be languages accepted by this NFA? Won’t it be the same as the above one?

(for some different question)
I got small hint about this. It was to add epsilon transition, but I don’t understand the need for it.
naVKgIC_8oj_v6TLAyjAhdOlLEpr4jsUAiYNw59d-2LifF5scOxn7rBw0AwCvmDwtFMZtv-s7DfXZAkt5OTNOksg7PNgzhEhyEXJ1JRmtN4nIELpWrJCIUaKA7uvrJatk6oTbd2k

Source-: https://www.cs.wcupa.edu/rkline/fcs/nfas.html
 
Last edited by a moderator:
They are different. An example of the first one are strings 01.01. 01, 010.010.010, 01010.01010. (The . doesn’t mean anything just so you can see clearly what is happening). And examples of the second one are 01.01.010.010.010. Do you now understand the difference?
And as far as the constructiom goes, there are certain algorithms on how to transfer regular expressions to NFAs. In the example that you showed, those algorithms were used. Try to look them up online, and try to understand them
 
I understand construction part. My confusion is the same what's the difference between
(01+010)* and (01)*+(010)*? am i missing sth? like order of evaluation of regular expressions or sth concepts that are important?
 
In the fist case (01+010)* expression in the parenthesis means "either 01 or 010", and then you can have an arbitrary long (including empty) sequence of them. That is a sequence of "molecules" where each one is either 01 or 010. For example 01.010.01.010.010.01 (using @Zermelo's method of putting dots for readability).
In the second case (01)* + (010)* you have a union of two types of sequences: either 01.01.01.01 or 010.010.010.010.
 
They are different. An example of the first one are strings 01.01. 01, 010.010.010, 01010.01010. (The . doesn’t mean anything just so you can see clearly what is happening). And examples of the second one are 01.01.010.010.010. Do you now understand the difference?
And as far as the constructiom goes, there are certain algorithms on how to transfer regular expressions to NFAs. In the example that you showed, those algorithms were used. Try to look them up online, and try to understand them
I believe your example for the second RE is incorrect: as can be seen from the NFA diagram, once you start "typing" 01.01.01 you cannot have any 010's, and vice versa. But you are right, of course, that the first and the second RE's are different
 
Yo
I believe your example for the second RE is incorrect: as can be seen from the NFA diagram, once you start "typing" 01.01.01 you cannot have any 010's, and vice versa. But you are right, of course, that the first and the second RE's are different
You’re right, I mixed them up! Thanks for the correction
 
Top