alexandre.aboulin
2 years ago
4 changed files with 39 additions and 40 deletions
@ -0,0 +1,15 @@ |
|||
import re |
|||
|
|||
def isChar(n): |
|||
return re.match(r'[a-z]', str(n)) is not None |
|||
|
|||
def isNumber(n): |
|||
return re.match(r'\d+', str(n)) is not None |
|||
|
|||
def getPrecedence(tok): |
|||
if tok == "(" or tok == "" or tok == "^": |
|||
return 4 |
|||
elif tok == "*" or tok == "/": |
|||
return 3 |
|||
elif tok == "+" or tok == "-": |
|||
return 2 |
Loading…
Reference in new issue