Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > Noob parser que...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 2344 of 2421
Post > Topic >>

Noob parser question

by imissfloppydisks@[EMAIL PROTECTED] Feb 27, 2008 at 09:05 PM

This is a CFG listed in the Aho (dragon) compiler text:

expr -> expr + term | expr - term | term
term -> term * factor | term / factor | factor
factor -> digit | (expr)
digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

It is intended to parse simple arithmetic expressions taking into
account the precedence of operators.  What I don't understand is why
you parse the operators with lower precedence first.  I have worked
through several examples by hand and it works but I don't understand
why it works.  Perhaps I should be content with that but I am a
perfectionist.

Thanks ...




 5 Posts in Topic:
Noob parser question
imissfloppydisks@[EMAIL P  2008-02-27 21:05:19 
Re: Noob parser question
Hans-Peter Diettrich <  2008-02-28 18:10:50 
Re: Noob parser question
Max Hailperin <max@[EM  2008-02-28 19:03:26 
Re: Noob parser question
Gene <gene.ressler@[EM  2008-02-28 17:54:43 
Re: Noob parser question
imissfloppydisks@[EMAIL P  2008-02-28 23:40:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 13:08:47 CDT 2008.