Files
boring-lang/boring/main.py

31 lines
1001 B
Python
Raw Normal View History

2021-05-05 19:32:55 -06:00
import sys
from typing import List
from boring.parse import boring_parser, TreeToBoring, pretty_print
2021-05-12 06:40:11 -06:00
from boring.type_checking import TypeChecker
2021-05-05 19:32:55 -06:00
if __name__ == "__main__":
with open(sys.argv[1]) as f:
tree = boring_parser.parse(f.read())
# print(tree)
result = TreeToBoring().transform(tree)
2021-05-12 06:40:11 -06:00
# pretty_print(result)
type_checker = TypeChecker()
while type_checker.with_module({}, result):
2021-05-28 23:57:07 -06:00
print("loop")
2021-05-12 06:40:11 -06:00
# type_checker.with_module({}, result)
2021-05-05 19:32:55 -06:00
pretty_print(result)
2021-05-12 06:40:11 -06:00
# tctb = TypeCheckTableBuilder()
# table: List[TypeComparison] = []
# tctb.with_module({}, table, result)
# for e in table:
# print(e)
# print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
# check_types(table)
# print("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv")
# for e in table:
# print(e)
2021-05-05 19:32:55 -06:00
# None, Some
# None skip, set
# Some set, check