#ifndef SCC_H
#define SCC_H
-struct edge {
- void *from;
- void *to;
-};
+#include "ast.h"
-struct components {
- int nnodes;
- void **nodes;
- struct components *next;
-};
-#define FOREACHCOMP(x, l) for(struct components *x = l; x != NULL; x = x->next)
-
-/**
- * Calculate the strongly connected components using Tarjan's algorithm:
- * en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
- *
- * Returns NULL when there are invalid edges
- *
- * @param number of nodes
- * @param data of the nodes
- * @param number of edges
- * @param data of edges
- */
-struct components *scc(int nnodes, void **nodedata, int nedges, struct edge *edgedata);
-
-/**
- * Free a list of components
- *
- * @param cs components
- * @param freefun function to free the data with, if NULL, data isn't freed
- */
-void components_free(struct components *cs, void (*freefun)(void *));
+// Split up the AST in strongly connected components
+struct ast *ast_scc(struct ast *ast);
#endif