from compiler.errors import * from compiler.lexer import Lexer, LexingContext from compiler.parser import Parser import os fname = os.path.abspath('./example.pmp') c = LexingContext(dict(), fname, dict(), dict()) try: with open(fname, 'r') as f: c.sources[fname] = f.read() lex = Lexer(fname, c) #for token in a.do_parse(): # print(token) a = Parser(lex) elems = a.parse() except CompilerError as err: err.print_context_message()