Regular Expression... Evaluator?

I was assigned a project, looks pretty simple but I just don't know where to begin!

In a command window, enter a regular expression...
Then take that RE and change it to a NFA-e, then that NFA-e to NFA, then that NFA to DFA, then that DFA to MDFA... and that result, I should create a file wich I can open in AFER (don't know if you've heard of it...)

Anyways, I need someone to give me a very good push; code is, of course, quite welcome... keep in mind it is strictly c/c++.
gabriella_leveronAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenData Warehouse Architect / DBACommented:

Hi gabriella_leveron,

This looks like a homework assignment, so I'll nudge a little and you can follow iwht more questions.  :)

The first thing that you're going to have to do is "tokenize" the items in the expression.  You can grab them "on the fly" from the input stream or build a list.  I'd suggest building a list.

TAN(1+SQRT(PI))       /*  A meaningless calculation, but a valid example  */

Token[0] = "TAN"
Token[1] = "("
Token[2] = "1"
Token[3] = "+"
etc...

Then convert this list of tokens into a tree structure that when perused, accesses the items in NFA-e form.

First we walk, then we run....  :)
Kent
0
gabriella_leveronAuthor Commented:
I've done Mathematical Expression Evaluators before...

But that is what has me, confused I guess...
When I say RE I mean the user will type in something like (11+0)*(00+1)* and then continue with what i told ya in the original post...

I'm not even crawling with this, dude!  If it were a homework assignment, like simple homework, I wouldn't bother posting, I would google.
0
Kent OlsenData Warehouse Architect / DBACommented:


Cool.  Then you should be off to a good start.  Build the tree such that it can be traversed to produce RPN.  From there the only difficulty should be in the understanding of each of the other notations.  (Sorry -- I don't know them all.)


Kent
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

andrewjbCommented:
Do you want to actually write the code, or just produce the outcome? The boost library has RE handling routines which I think are quite flexible..
0
CayceCommented:
Check out this link:

http://www.undu.com/Articles/021016.html

It shows how to use the Microsoft VBScript Regular Expression library in Delphi. The procedure to use it under BCB is the same (just the code changes from Pascal to C++, no big deal). This library comes with almost every version of windows.
0
gabriella_leveronAuthor Commented:
I actually have to write the code for it :S
0
CayceCommented:
So, is it homework/school project or not?
0
CayceCommented:
This links could give you some insight:
http://fpl.cs.depaul.edu/cpitcher/csc448/
http://www3.sympatico.ca/dbiggar/
http://www.cs.vassar.edu/~cs240/
http://www.cs.unc.edu/~anderson/teach/comp181/comp181.html
http://www.clemburg.com/resources/MS_Word_Regexes_and_Special_Chars.html
http://www.clemburg.com/resources/find_with_tso.html
http://enterprise.ic.gc.ca/~jfriedl/regex/

Guess you'll have to research in your school/local library for most of what you want to do.
There's tons of books that go thru the subjects you need (http://theory.lcs.mit.edu/~iandc/References/bruggemann-kleinw1998:229.html). Coding will be the easiest part, but you need to research about the concepts behing of what you are asking for. Don't expect EE experts to give you all the code you need.

I hope the papers and college courses I point you to will be of any help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.