Files
calc_engine/main.py
T

28 lines
702 B
Python
Executable File

import token
import tokenizer
import expression
import calc_engine
import json
#fileLocation = input('File Path to JSON: ')
#json = json.loads(open(fileLocation).read())
userInput = input('Enter your formula: ')
tokens = tokenizer.get_tokens_from_expression_string(userInput)
#with open("expression.json", "r") as f:
# j = json.load(f)
# exp = expression.Expression(json.loads(j))
# print(exp)
#results = calc_engine.calculate_results(tokens.copy())
#print(results)
tokens = tokenizer.replace_variables(tokens, [23, 46, 89])
for t in tokens:
print("%s (%s) " %(t.value, token.TokenType.get_token_type_name(t.type)), end = "")
print()
#def factors(factor_object, starting_point, variable_type)