From 1b8b13bbb7fd475ed107ce50c27559b5dfaa3414 Mon Sep 17 00:00:00 2001 From: Harshana-2000 Date: Tue, 9 Apr 2024 21:19:10 +0530 Subject: [PATCH] update --- interpreter/execution_engine.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/interpreter/execution_engine.py b/interpreter/execution_engine.py index 3e67087..7982fae 100644 --- a/interpreter/execution_engine.py +++ b/interpreter/execution_engine.py @@ -78,11 +78,12 @@ def interpret(self, file_name): self.standard_tree.build_standard_tree(self.parse_ast_tree) self.parse_st_tree = self.standard_tree.standard_tree self.cse_machine.execute(self.parse_st_tree) - #self.raw_output = self.cse_machine._generate_raw_output() + self.raw_output = self.cse_machine._generate_raw_output() self.output = self.cse_machine._generate_output() self.cse_machine._print_cse_table() - #print("Raw Output:", self.raw_output) + print("Raw Output:", self.raw_output) print("Output:", self.output) + except FileNotFoundError: print(f"File '{file_name}' not found.") @@ -186,4 +187,14 @@ def get_output(self): Returns: str: The formatted output generated by the CSE machine. """ - return self.output \ No newline at end of file + return self.output + def clean_up(self): + """ + Reset all attributes to their initial state. + """ + self.tokens = [] + self.filtered_tokens = [] + self.parse_ast_tree = None + self.parse_st_tree = None + self.raw_output = None + self.output = None \ No newline at end of file