Regular expression to NFA -- confusing regular expressions-:

In summary, the conversation discusses the conversion of the regular expression (01+010)* to NFA and the languages accepted by it. The need for an epsilon transition is also mentioned and its purpose is explained. The importance of understanding this concept is emphasized.
  • #1
shivajikobardan
674
54
Homework Statement
Regular expression to NFA -- confusing regular expressions-:
Relevant Equations
none
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).
nmXLE14mKI4PtFf4GtDc_PgenECvC_h_m9Yrbrg99hHZh258F9.jpg


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.
sg7PNgzhEhyEXJ1JRmtN4nIELpWrJCIUaKA7uvrJatk6oTbd2k.png

Source-: https://www.cs.wcupa.edu/rkline/fcs/nfas.html
 
Physics news on Phys.org
  • #2
shivajikobardan said:
But idk how to convert this to NFA
I don't know is not good enough: make a start and show your efforts.

shivajikobardan said:
What will be languages accepted by this NFA? Won’t it be the same as the above one?
Test both expressions with the string 01010.

shivajikobardan said:
(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.
The material you linked includes exactly the same pair of expressions as you have, just with different symbols. The need for the epsilon transition is to deal with the fact that (01+010)* (Example 2 (ab∪aba)*) is different from (01)*+(010)* (Example 3 (ab)*∪(aba)*. Work through that material and the examples until you understand it.
 
  • Like
Likes Jarvis323 and sysprog

FAQ: Regular expression to NFA -- confusing regular expressions-:

What is a regular expression?

A regular expression is a sequence of characters that defines a search pattern. It is commonly used in computer science and programming to find and manipulate text based on certain patterns.

How is a regular expression converted to an NFA?

A regular expression is converted to an NFA (non-deterministic finite automaton) using a process called Thompson's construction. This involves breaking down the regular expression into smaller subexpressions and creating states and transitions in the NFA based on the rules of the regular expression.

What makes regular expressions confusing?

Regular expressions can be confusing because they use a combination of symbols and characters that have specific meanings and can be difficult to understand at first glance. Additionally, there are different flavors of regular expressions, which can add to the confusion.

How can I improve my understanding of regular expressions?

To improve your understanding of regular expressions, it is helpful to practice writing and testing them. There are also many online resources and tutorials available that can provide a deeper understanding of how regular expressions work.

Can regular expressions be used in any programming language?

Yes, regular expressions are supported in most programming languages and can be used for tasks such as data validation, search and replace operations, and text manipulation. However, the syntax and features may vary slightly between languages.

Similar threads

Replies
1
Views
880
Replies
5
Views
1K
Replies
1
Views
1K
Replies
6
Views
3K
Replies
1
Views
2K
Replies
17
Views
1K
Replies
1
Views
20K
Replies
3
Views
877
Back
Top