Last active
August 29, 2015 14:07
-
-
Save alexandervasyuk/26fd6a57649af5e887f7 to your computer and use it in GitHub Desktop.
simpleShuntingYardPseudo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
While there are tokens to be read: | |
Read a token. | |
If the token is a number, then add it to the output queue. | |
If the token is an operator, o1, then: | |
while there is an operator token, o2, at the top of the operator stack, and | |
o1 has precedence less than or equal to that of o2, | |
pop o2 off the stack, onto the output queue; | |
push o1 onto the stack. | |
When there are no more tokens to read: | |
While there are still operator tokens in the stack: | |
Pop the operator onto the output queue. | |
Exit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment