473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Albegrical Expression

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
kl**************@altervista.org
http://kleidemos.altervista.org/
Jul 22 '05 #1
8 1199
Kleidemos wrote:
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.

Jul 22 '05 #2
Hello,

"Kleidemos" <fr***********@tin.it> writes:
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)


Perhaps you are interested in www.ginac.de .

Bye,
Chris Dams
Jul 22 '05 #3
It is difficult write a personal parser???

Tnk

--
Kleidemos
C++ Programmer
kl**************@altervista.org
http://kleidemos.altervista.org/
Jul 22 '05 #4
Kleidemos wrote:
It is difficult write a personal parser???


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.
Jul 22 '05 #5
On Sun, 11 Jan 2004 19:53:10 GMT in comp.lang.c++, "Kleidemos"
<fr***********@tin.it> was alleged to have written:
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.

Jul 22 '05 #6

"Kleidemos" <fr***********@tin.it> wrote in message
news:pG********************@news4.tin.it...
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)


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
Jul 22 '05 #7
In article <pG********************@news4.tin.it>, "Kleidemos"
<fr***********@tin.it> wrote:
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 da***********@wanadoo.fr if you want it. It should work
in C++ but I haven't tried it.

David Masters
Jul 22 '05 #8
"Kleidemos" , dans le message (comp.lang.c++:731928), a écrit*:
How I can parsing and resolving albegrical expression with an algoritm in
C++??


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

Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
22
by: Tony Johansson | last post by:
Hello Experts! I'm reading i a book about C++ and they mention infix with telling what it is. I hope you out there can do so. Many thanks! //Tony
2
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am...
14
by: John Temples | last post by:
Given this code: extern volatile unsigned char v; int main(void) { v; return 0; }
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
28
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.