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?
 
CayceConnect With a Mentor Commented:
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
 
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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
All Courses

From novice to tech pro — start learning today.