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

Help with Parser

Greetings,

I have to write the following parser

{ (A) OR (B) OR (C) } {{ (E) AND (F) } OR { (E) OR (C) }}

Here each alphabet internally represents an integer. I am new to
parsing and do not have much idea. What would be the best approach to
this? Any pointers would be very helpful.

Thanks very much,

Koolrans

Apr 11 '06 #1
5 1470
Koolrans wrote:
Greetings,

I have to write the following parser

{ (A) OR (B) OR (C) } {{ (E) AND (F) } OR { (E) OR (C) }}

Here each alphabet internally represents an integer. I am new to
parsing and do not have much idea. What would be the best approach to
this? Any pointers would be very helpful.


Chapter 6 in Stroustrup, if memory serves me, "Expressions", contains
a full example of an expression parser. Or you could get a book on
Lex and Yacc and use them.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Apr 11 '06 #2

Victor Bazarov wrote:
Koolrans wrote:
Greetings,

I have to write the following parser

{ (A) OR (B) OR (C) } {{ (E) AND (F) } OR { (E) OR (C) }}

Here each alphabet internally represents an integer. I am new to
parsing and do not have much idea. What would be the best approach to
this? Any pointers would be very helpful.


Chapter 6 in Stroustrup, if memory serves me, "Expressions", contains
a full example of an expression parser. Or you could get a book on
Lex and Yacc and use them.


spirit being an alternative to lex and yacc.

Apr 11 '06 #3
Noah Roberts wrote:
Victor Bazarov wrote:
Koolrans wrote:
Greetings,

I have to write the following parser

{ (A) OR (B) OR (C) } {{ (E) AND (F) } OR { (E) OR (C) }}

Here each alphabet internally represents an integer. I am new to
parsing and do not have much idea. What would be the best approach to
this? Any pointers would be very helpful.


Chapter 6 in Stroustrup, if memory serves me, "Expressions", contains
a full example of an expression parser. Or you could get a book on
Lex and Yacc and use them.


spirit being an alternative to lex and yacc.


Thanks you. That was helpful.

Apr 12 '06 #4

Victor Bazarov wrote:
Koolrans wrote:
Greetings,

I have to write the following parser

{ (A) OR (B) OR (C) } {{ (E) AND (F) } OR { (E) OR (C) }}

Here each alphabet internally represents an integer. I am new to
parsing and do not have much idea. What would be the best approach to
this? Any pointers would be very helpful.


Chapter 6 in Stroustrup, if memory serves me, "Expressions", contains
a full example of an expression parser. Or you could get a book on
Lex and Yacc and use them.

V


Thanks for the input. I looked into that but looks like it is too heavy
for my purpose. Will definitely go over it in future if my need
increases.

Koolrans

Apr 12 '06 #5

Victor Bazarov wrote:
Koolrans wrote:
Greetings,

I have to write the following parser

{ (A) OR (B) OR (C) } {{ (E) AND (F) } OR { (E) OR (C) }}

Here each alphabet internally represents an integer. I am new to
parsing and do not have much idea. What would be the best approach to
this? Any pointers would be very helpful.


Chapter 6 in Stroustrup, if memory serves me, "Expressions", contains
a full example of an expression parser. Or you could get a book on
Lex and Yacc and use them.


Sorry, I meant Lex and Yacc were heavy for purpose. I was able to get
the examples for the book mentioned by you. They are very helpful.

koolrans

Apr 12 '06 #6

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

Similar topics

0
by: marktm | last post by:
Hi- I am using the following code and want to retrieve an attributes value. I want to loop through the xml file and add the attribute values to an array. The line in question is marked with...
2
by: marktm | last post by:
Hi- I am using the following code and want to retrieve an attributes value. I want to loop through the xml file and add the attribute values to an array. The line in question is marked with...
15
by: kpp9c | last post by:
I am kind of in a bit of a jam (okay a big jam) and i was hoping that someone here could give me a quick hand. I had a few pages of time calculations to do. So, i just started in on them typing...
0
by: Xamalaek | last post by:
Hello, I need some help with the DOM TreeWalker API. I modified the Xerces DOMPrint sample because I wanted to play around with the DOMTreeWalker API to iterate through the sample.xml file. ...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
4
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. ...
7
by: gheissenberger | last post by:
HELP! Guy who was here before me wrote a script to parse files in Python. Includes line: print u where u is a line from a file we are parsing. However, we have started recieving data from...
0
by: ashishbathini | last post by:
Guys I need your help .... In this code I have to change the value of the frequency ... the code takes the values of frequency and bit rate as inputs but i have to enter the value of freq manually...
1
by: hellt | last post by:
today i've decided to use optionparser instead of GetOpt and unfortunately i've got an error which i cant handle my pice of code: from optparse import OptionParser def main(): usage =...
4
by: Bartc | last post by:
"vaib" <vaibhavpanghal@gmail.comwrote in message news:26a44cc5-0f08-41fe-859b-0d27daf3ca1d@f24g2000prh.googlegroups.com... I don't know the formal approach to these things but I haven't come...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.