Fixed a bug in the tokenizer to make sure it reverses the list before returning. Fixed up the calc engine, however addition/subtraction bugs still exist.

This commit is contained in:
2020-04-08 15:05:34 -05:00
parent c42c8471c0
commit ee9ba528c6
3 changed files with 37 additions and 19 deletions
+9 -5
View File
@@ -1,8 +1,12 @@
import token
import tokenizer
#userInput = input('Enter your formula: ')
tokens = tokenizer.get_tokens_from_expression_string("i + 2 / i (3 * n) 5")
import calc_engine
for t in tokens:
print("%s (%s) " %(t.value, token.TokenType.get_operator_name(t.type)), end = "")
print()
userInput = input('Enter your formula: ')
tokens = tokenizer.get_tokens_from_expression_string(userInput)
results = calc_engine.calculate_results(tokens)
print(results)
#for t in tokens:
# print("%s (%s) " %(t.value, token.TokenType.get_operator_name(t.type)), end = "")
#print()