468,537 Members | 1,735 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

Algebraic Parser

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

Jul 23 '05 #1
6 2610
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Himanshu Garg | last post: by
28 posts views Thread by Marc Gravell | last post: by
6 posts views Thread by DavidM | last post: by
18 posts views Thread by Just Another Victim of the Ambient Morality | last post: by
2 posts views Thread by Federico Zenith | last post: by
14 posts views Thread by serave | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.