Connecting Tech Pros Worldwide Forums | Help | Site Map

Albegrical Expression

Kleidemos
Guest
 
Posts: n/a
#1: Jul 22 '05
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
--
Kleidemos
C++ Programmer
kleidemosNO_SPAM@altervista.org
http://kleidemos.altervista.org/



Jacques Labuschagne
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Albegrical Expression


Kleidemos wrote:[color=blue]
> 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)
>[/color]

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.

Chris Dams
Guest
 
Posts: n/a
#3: Jul 22 '05

re: Albegrical Expression


Hello,

"Kleidemos" <francesca8810@tin.it> writes:
[color=blue]
>How I can parsing and resolving albegrical expression with an algoritm in
>C++??
>This is an example of a exprexion that I wont parse:[/color]
[color=blue]
>5 * (3a + 4a) + 4a * (x+1)(x-1)[/color]

Perhaps you are interested in www.ginac.de .

Bye,
Chris Dams
Kleidemos
Guest
 
Posts: n/a
#4: Jul 22 '05

re: Albegrical Expression


It is difficult write a personal parser???

Tnk

--
Kleidemos
C++ Programmer
kleidemosNO_SPAM@altervista.org
http://kleidemos.altervista.org/


Azathot
Guest
 
Posts: n/a
#5: Jul 22 '05

re: Albegrical Expression


Kleidemos wrote:
[color=blue]
> It is difficult write a personal parser???[/color]

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

--
---
*************** | Have you ever retired a human by mystake?
*** Azathot *** |
*************** | To contact me, ask me gently. Thanks.
David Harmon
Guest
 
Posts: n/a
#6: Jul 22 '05

re: Albegrical Expression


On Sun, 11 Jan 2004 19:53:10 GMT in comp.lang.c++, "Kleidemos"
<francesca8810@tin.it> was alleged to have written:[color=blue]
>It is difficult write a personal parser???[/color]

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

Jeff Flinn
Guest
 
Posts: n/a
#7: Jul 22 '05

re: Albegrical Expression



"Kleidemos" <francesca8810@tin.it> wrote in message
news:pGhMb.94348$_P.3560771@news4.tin.it...[color=blue]
> 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)[/color]

Spirit will allow you to implement this in your C++ code natively. It is
part of boost or standalone:

http://www.boost.org/libs/spirit/index.html


http://spirit.sourceforge.net/

There are several expression examples.

Jeff F


David Masters
Guest
 
Posts: n/a
#8: Jul 22 '05

re: Albegrical Expression


In article <pGhMb.94348$_P.3560771@news4.tin.it>, "Kleidemos"
<francesca8810@tin.it> wrote:
[color=blue]
> 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)
>[/color]
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 david.masters@wanadoo.fr if you want it. It should work
in C++ but I haven't tried it.

David Masters
Marc
Guest
 
Posts: n/a
#9: Jul 22 '05

re: Albegrical Expression


"Kleidemos" , dans le message (comp.lang.c++:731928), a écrit*:
[color=blue]
> How I can parsing and resolving albegrical expression with an algoritm in
> C++??[/color]

http://www.eleves.ens.fr/home/ollivi.../mathexpr.html

Closed Thread