| | |
Is there a program that creates DFA from expression
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
•
•
Join Date: Oct 2004
Posts: 1
Reputation:
Solved Threads: 0
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
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
•
•
•
•
Originally Posted by Neco_Coneco
Like if I enter ab* it will draw a state diagramI know they have ones that convert nfa to dfa but I have yet to find one that will draw from an expression. Thanks
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
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.
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
![]() |
Similar Threads
- C++ & embedded Python , Expression Evaluator (Python)
- How do I create a program that creates a file that stores the variables data? (C++)
- How do I create a program that creates a file in C#? (C#)
- What's the HARDEST program you've written? (Computer Science)
- Any Boolean Expression to Sum of Minterms (C++)
- need help on corporate sales program (C++)
Other Threads in the Computer Science Forum
- Previous Thread: I need graduation project better in wireless applications
- Next Thread: Programming .exe files directly
Views: 5675 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Computer Science
ai algorithm algorithms amazon assignment assignmenthelp automata battery bigbrother binary bittorrent bizarre bletchleypark blogging business cern clueless compiler computer computers computerscience computertrackingsoftware connect conversion csc data dataanalysis development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy floatingpoint foreclosuresoftware fuel gadgets givemetehcodez government graphics hardware history homework homeworkassignment humor ibm idea ideas internet iphone ipod itcontracts jobs kindle laser laws lazy linkbait lsmeans mining mobileapplication msaccess netbeans networking news os parser piracy principles programming rasterizer research sam-being-cute sas science security sex simulation software spoonfeeding spying sql-server stephenfry student study sweden syntactic technology textfield tree turing turingtest two'scompliment uk virus warehouse ww2




I know they have ones that convert nfa to dfa but I have yet to find one that will draw from an expression. Thanks 
