472,789 Members | 1,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 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 2730
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.