Albegrical Expression

K

Kleidemos

How I can parsing and resolving albegrical expression with an algoritm in
C++??
This is an example of a exprexion that I wont parse:

5 * (3a + 4a) + 4a * (x+1)(x-1)

Tanks
 
J

Jacques Labuschagne

Kleidemos said:
How I can parsing and resolving albegrical expression with an algoritm in
C++??
This is an example of a exprexion that I wont parse:

5 * (3a + 4a) + 4a * (x+1)(x-1)

Have a look at tools like Lex and Yacc (or Flex and Bison, if you
prefer). I avoid coding parsers by hand wherever possible.

HTH,
Jacques.
 
A

Azathot

Kleidemos said:
It is difficult write a personal parser???

Simply, it is useless, when you have something alredy working,
well-functioning and well-formed as Bison++ . ;-)
 
D

David Harmon

It is difficult write a personal parser???

It is much easier than messing around with YACC or Bison for simple
stuff. See the calculator example(s) code in Stroustrup.
 
D

David Masters

"Kleidemos" said:
How I can parsing and resolving albegrical expression with an algoritm in
C++??
This is an example of a exprexion that I wont parse:

5 * (3a + 4a) + 4a * (x+1)(x-1)
I've done this in C. If you want a copy send me an email. BTW, you aren't
very clear how multiplication happens in your notation. Mine uses normal C
rules.
send a mail to (e-mail address removed) if you want it. It should work
in C++ but I haven't tried it.

David Masters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top