Skip to content

Commit

Permalink
Merge branch 'feature/cse_machine' of https://github.com/malinduGamag…
Browse files Browse the repository at this point in the history
…e/RPAL-Interpreter into feature/cse_machine
  • Loading branch information
malinduGamage committed Apr 9, 2024
2 parents 40da677 + f455f62 commit 32a04d2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions interpreter/execution_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -186,4 +187,14 @@ def get_output(self):
Returns:
str: The formatted output generated by the CSE machine.
"""
return self.output
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

0 comments on commit 32a04d2

Please sign in to comment.