You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
478 B
Python

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()