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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user