Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Regular Expression... Evaluator?

Posted on 2004-10-21
Medium Priority
Last Modified: 2013-11-17
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++.
Question by:gabriella_leveron
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
LVL 46

Expert Comment

by:Kent Olsen
ID: 12372792

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] = "+"

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....  :)

Author Comment

ID: 12372995
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.
LVL 46

Expert Comment

by:Kent Olsen
ID: 12373086

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.)

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 12

Expert Comment

ID: 12379334
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..

Expert Comment

ID: 12381373
Check out this link:


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.

Author Comment

ID: 12381473
I actually have to write the code for it :S

Expert Comment

ID: 12381613
So, is it homework/school project or not?

Accepted Solution

Cayce earned 2000 total points
ID: 12381810
This links could give you some insight:

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.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question