ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
Re: [Tutor] newbie evalpostfix [writing a infix parser in Python]
by Danny Yoo other posts by this author
Dec 12 2003 12:31AM messages near this date
[Tutor] newbie evalpostfix | RE: [Tutor] do_it()
On Fri, 12 Dec 2003, j hansen wrote:

>  How do I modify evalpostfix to parse from left to right so that it
>  follows the order of operations?

Hi j,


Are you referring to the 'evalpostfix' from 'How To Think Like a Computer
Scientist':

    http://www.ibiblio.org/obp/thinkCSpy/chap18.htm

Please don't force us to guess.  *grin* Try to make it easier for people
to help you with your question.


It sounds like you'd like to try writing an 'infix' parser.  Infix parsers
are actually a little bit harder to do than a postfix parser, because of
the whole issue of operator precedence (as well as parenthesized
expressions).  If you don't need to handle parenthesized expressions, then
it won't be so difficult.


Will you try to handle things like:

   (a + b) * c

as well as

   a + b * c

?

If you do try to handle the parenthesized expressions, then you're in for
some work.  *grin* Tell us more about the problem.



Good luck to you!


_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
j hansen
Danny Yoo

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved