By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,408 Members | 945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,408 IT Pros & Developers. It's quick & easy.

Algebraic Parser

P: n/a
Any general ideas on techniques for creating parsers for algebraic and
linear equations?

Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
Okay, thanks. I'll check that out.

Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.