working on adding type system
This commit is contained in:
25
boring/main.py
Normal file
25
boring/main.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import sys
|
||||
from typing import List
|
||||
from boring.parse import boring_parser, TreeToBoring, pretty_print
|
||||
from boring.type_checker import TypeCheckTableBuilder, TypeComparison, check_types
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(sys.argv[1]) as f:
|
||||
tree = boring_parser.parse(f.read())
|
||||
# print(tree)
|
||||
result = TreeToBoring().transform(tree)
|
||||
pretty_print(result)
|
||||
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)
|
||||
|
||||
# None, Some
|
||||
# None skip, set
|
||||
# Some set, check
|
||||
Reference in New Issue
Block a user