Created a small utility program to generate JSON files for testing the main input.

This commit is contained in:
2020-04-12 00:03:33 -05:00
parent 4386b1af99
commit 1265f8ac3e
7 changed files with 294 additions and 8 deletions
+12 -7
View File
@@ -1,12 +1,17 @@
import token
import tokenizer
import calc_engine
import json
userInput = input('Enter your formula: ')
tokens = tokenizer.get_tokens_from_expression_string(userInput)
results = calc_engine.calculate_results(tokens)
print(results)
fileLocation = input('File Path to JSON: ')
#json = json.loads(open(fileLocation).read())
#for t in tokens:
# print("%s (%s) " %(t.value, token.TokenType.get_token_type_name(t.type)), end = "")
#print()
#userInput = input('Enter your formula: ')
tokens = tokenizer.get_tokens_from_expression_string("2 + 6 / 2")
#results = calc_engine.calculate_results(tokens.copy())
#print(results)
for t in tokens:
print("%s (%s) " %(t.value, token.TokenType.get_token_type_name(t.type)), end = "")
print()