943,431 Members | Top Members by Rank

Ad:
Sep 28th, 2004
0

Is there a program that creates DFA from expression

Expand Post »
Like if I enter ab* it will draw a state diagram I know they have ones that convert nfa to dfa but I have yet to find one that will draw from an expression. Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Neco_Coneco is offline Offline
2 posts
since Sep 2004
Oct 4th, 2004
0

Re: Is there a program that creates DFA from expression

hey buddy i cannot solve yr problem but may be u can solve mine
i need a cog\de that can conver a regular expresion to NFA and then to DFA
andthen compare the 2 regular expressions to find out if they are equal.
please do reply in either case if u wish to help me or not .
thank u
nilay007@rediffmail.com





Quote originally posted by Neco_Coneco ...
Like if I enter ab* it will draw a state diagram I know they have ones that convert nfa to dfa but I have yet to find one that will draw from an expression. Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bunty is offline Offline
1 posts
since Oct 2004
Oct 5th, 2004
0

Re: Is there a program that creates DFA from expression

Sorry I don't know.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Neco_Coneco is offline Offline
2 posts
since Sep 2004
Oct 6th, 2004
0

Re: Is there a program that creates DFA from expression

For obvious reasons I can't recite code from memory that'll do what you're asking for, but there does exist a regexp-->DFA algorithm...on paper. You're probably already familiar with it, it's the one where you create a start edge labelled with the original expression, and then perform a sequence of splits/branches/loops based on the operators in the expression.

That can be done in code just as easily (if not easier) - but you'll have to represent the DFA as a table. Specifically, a list of edges. Take the starting edge (labelled with the original expression) and apply a transformation according to the highest-precedence operator in the expression. Then recurse onto the resulting edge(s) and do the same for their labels.

I recommend doing it in Scheme ; )

The main function might look like
(elaborate-DFA edge next-newstate),
where edge is a representation of a transition in the graph of the form
(origin destination label).
...


Of course, if you just want a nifty little app that'll draw pretty pictures for you, I believe there's one called Deus Ex Machina. Google may have something to say about that.
Last edited by Nuez_Jr; Oct 6th, 2004 at 6:27 am. Reason: addon
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Nuez_Jr is offline Offline
18 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: I need graduation project better in wireless applications
Next Thread in Computer Science Forum Timeline: Programming .exe files directly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC