Beispiel #1
0
 def _compile_print_expression(self, node: ParseTreeNode):
     if node.has_child("GET"):
         return self._add_instruction(
             op="GET"
         )
     else:
         self._add_instruction(
             result_var=node.get_child("expression").result,
             op=node.get_a_child(["PRINT", "PRINTLN"]).content.token.name
         )
         return "NULL RESULT"
Beispiel #2
0
def inherit_node_result(node: ParseTreeNode, child_names: List[str]):
    child = node.get_a_child(child_names)
    node.result = child.result