#!/usr/bin/env python
from os.path import realpath, dirname, join
import sys
sys.path.insert(0, join(dirname(realpath(sys.argv[0])), '..', 'src'))
from maxixe.parser import Parser, SugaredParser
from maxixe.checker import Checker
def main(args):
parser_cls = Parser
while args and args[0].startswith('--'):
option = args.pop(0)
if option == '--sugar':
parser_cls = SugaredParser
else:
raise NotImplementedError(option)
filename = args.pop(0)
with open(filename, 'r') as f:
p = parser_cls(f.read())
proof = p.proof()
c = Checker(proof)
c.check()
if __name__ == '__main__':
main(sys.argv[1:])
print('ok')
sys.exit(0)