TOPOLOGICAL_SORT(G=(V,E))
- call DFS(G) to compute f[v] for each vertex v ∈ V
- as each vertex is finished, insert it into the front of a linked list
- Return the linked list.
POST_ORDER(T)
- for c in T.children() do
- POST_ORDER(c)
- T.evaluate
A → B C A.s = B.b B.inh = f(C.c, A.s)
D → T L L.inh = T.type T → int T.type = int T → float T.type = float L → L1, id L1.inh = L.inh addType(id.entry, L.inh) L → id addType(id.entry, L.inh)