Skip to content

Conversation

@izanbf1803
Copy link
Contributor

Working implementation of a "calculator" (math expression parser) using the Shunting-yard algorithm.

Copy link
Owner

@keon keon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, man
I will accept this one after the fixes. but in the future, I am thinking we should move the whole design related stuff to another repo and focus only algorithmic stuff here. What do you think?

"""
return token in __operators__

def higherPriority(op1, op2):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snake case

'/': 1,
}

def isOperator(token):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert it to snake case

expression String: The expression
type Type (optional): Number type [int, float]
"""
opStack = deque() # operator stack
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snake case for the values, too

__operators__ = "+-/*"
__parenthesis__ = "()"
__priority__ = {
'+': 0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 spaces instead of tab

@izanbf1803
Copy link
Contributor Author

Requested changes applied.

@keon
Copy link
Owner

keon commented Apr 29, 2017

awesome thanks

@keon keon merged commit 3984f59 into keon:master Apr 29, 2017
@izanbf1803
Copy link
Contributor Author

izanbf1803 commented Apr 29, 2017

About the question of move related stuff to other repo, i think this is algorithmic stuff. It uses Dijkstra's Shunting-yard algorithm simplified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants