def get_result(self, test): tokenizer = Tokenizer(text=test) parser = Parser(tokenizer) try: tree = parser.parse() return AstVizGen(tree).return_str_tree() except Error as e: return e.message
def run(input_f, output_f): code = [] file = open(input_f, "r") for line in file: line = line.replace('\n', '') if len(line) > 0: code.append(line) parser = Parser() gen = Generator() parser.set_code_lines(code) gen.generate(output_f, parser.parse())
def print_ast(self): tokenizer = Tokenizer(self.file) parser = Parser(tokenizer) tree = parser.parse() AstVizGen(tree).generate()