from lark import Lark with open("termdef.lark") as parse_file: parser = Lark(parse_file) with open("betarules.rules") as b: rules_text = "\n".join(b.readlines()) print(parser.parse(rules_text).pretty())