On Jul 1, 2009, at 5:27 AM, Eduardo Cavazos wrote:

Hello,

Below is a Scheme version of the shunting yard algorithm as explained on this page:

    http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm

Example:

    > (infix 3 + 4 * 5 - 6 ^ 7 + 8)
    (+ (- (+ 3 (* 4 5)) (^ 6 7)) 8)

A few questions:

1. You're not handing left/right associativity, right?
2. Do you handle parenthesized subexpressions? (there seems to be a missing
   recursive call)
3. Why are you using a circular list of sentinels at the end?
4. What's up with the empty lines in your post?  Is this intentional?

Would you write it differently? If so, and you care to share, let's see!

I would probably use match (aka IU-match) for this if I'm just exploring.
[I may post an example later, if I find the time]

Aziz,,,

Reply via email to