473,323 Members | 1,551 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,323 software developers and data experts.

Algebraic Parser

Any general ideas on techniques for creating parsers for algebraic and
linear equations?

Jul 23 '05 #1
6 2751
DennisNedry wrote:
Any general ideas on techniques for creating parsers for algebraic and
linear equations?


Yes. Create them. Any particular C++ language questions?
Jul 23 '05 #2
"DennisNedry" <be******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Any general ideas on techniques for creating parsers for algebraic and
linear equations?


Some C++ (or C) tools that can help generate parsers include:
- Flex http://www.gnu.org/software/flex/
A good old proven solution for generating parsing code/tables.
- Boost::spirit http://www.boost.org/libs/spirit/
A template based solution (no separate code generation)
- ANTLR http://www.antlr.org/
Also a popular generator (for C++ & more), but I never used it.
Of course, hand-coding is possible as well, all depends on
the complexity of what you are trying to do.

hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Jul 23 '05 #3
Okay. Is there a more efficient way to parse this data (in C++) than
doing character comparisons on the entire user input such as:

for(char='A';char<='Z';char++){
for(i=0;user_input[i]!=NULL;i++){
if(user_input[i]==char){

and then dumping the matches into a variable in a structure?
Sorry if this is a dumb question, I'm relatively new to C++.

Jul 23 '05 #4
Ivan Vecerina wrote:
"DennisNedry" <be******@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Any general ideas on techniques for creating parsers for algebraic
and linear equations?


Some C++ (or C) tools that can help generate parsers include:
- Flex http://www.gnu.org/software/flex/
A good old proven solution for generating parsing code/tables.
- Boost::spirit http://www.boost.org/libs/spirit/
A template based solution (no separate code generation)


Which has examples of doing exactly what you're asking for.

Jeff
Jul 23 '05 #5
DennisNedry wrote:
Okay. Is there a more efficient way to parse this data (in C++) than
doing character comparisons on the entire user input such as:

for(char='A';char<='Z';char++){
for(i=0;user_input[i]!=NULL;i++){
if(user_input[i]==char){

and then dumping the matches into a variable in a structure?
Sorry if this is a dumb question, I'm relatively new to C++.


What books are you reading? If you are interested in expression
parsing, chapter 6 of "The C++ Programming Language" by Stroustrup
has a good example of that.

V
Jul 23 '05 #6
Okay, thanks. I'll check that out.

Jul 23 '05 #7

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

Similar topics

1
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c...
3
by: Himanshu Garg | last post by:
Hello, I am trying to pinpoint an apparent bug in HTML::Parser. The encoding of the text seems to change incorrectly if the locale isn't set properly. However Parser.pm in the directory...
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...
6
by: DavidM | last post by:
Hi, Are there any libraries for manipulating algebraic expression trees? In particular, take an expression tree and simplify it down. I'm working up the next release of PyGene, the genetic...
9
by: Cristian | last post by:
algebraic expression 'a*b+c' with CIN .Is it possible? How to transfer the algebraic expression 'a*b+c' to the variable s (all double) with cout in a "Console Application" ? cout<<"Input a,b,c...
0
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): ...
18
by: Just Another Victim of the Ambient Morality | last post by:
Is pyparsing really a recursive descent parser? I ask this because there are grammars it can't parse that my recursive descent parser would parse, should I have written one. For instance: ...
2
by: Federico Zenith | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello everybody, I am looking into a problem that probably someone had before, so I hope I can avoid reinventing the wheel... I am looking into...
14
by: serave | last post by:
How do i evaulate a mathematical expression that is entered in a text field. Ex: Text Fields: Xo=23 X1= 250 Expression: y = Xoe^(x1+Xo)-cos(X0+X1)+23Xo
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.