systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
top_down.py
Go to the documentation of this file.
1from contextlib import contextmanager
2from lark.visitors import Interpreter
3# visit_children_decor first visit the child and then execute the current function
4
5
7 variable_binding_stack = list()
8
9 @staticmethod
10 def get_type(name):
11 for var_dict in reversed(VariableBindings.variable_binding_stack):
12 if name in var_dict:
13 return var_dict[name]
14 return None
15
16
17@contextmanager
18def some_vars(var_dict):
19 VariableBindings.variable_binding_stack.append(var_dict)
20 yield
21 VariableBindings.variable_binding_stack.pop()
22
23
24class TopDown(Interpreter):
25 def __default__(self, t):
26 self.__push_up(t)
27 return t
28
29 def __push_up(self, current_node):
30 current_node.children = self.visit_children(current_node)
31
32 def __init__(self):
33 pass
34
__push_up(self, current_node)
Definition top_down.py:29