#!/usr/bin/env python3 import sys from lexer import lexer with open(sys.argv[1], 'rb') as f: data = f.read() data2 = data.decode('ascii') lexer.input(data2) while True: tok = lexer.token() if not tok: break # No more input print(tok)