The visitor is particular to the graph. We didn't write it following the design patterns because it is too specific. We can't do a visit using a "depth first" algorithm or another kind of traversal algorithm because the traversal depends on the tag. We mean we need to know the type of the tag to decide what way we will follow, thus, we can't make a general visitor.
We traverse the graph using the "function first" concept. It means that as soon as we find an identificator function, we go through its "name:", "type:", and other tags to finish by the "chan:" tag. This tag gives us the next function to visit. To each identifier corresponds a function visit_identifier(). The main work in the function is the extraction of information about the node and the call to builders (we describe builders in the next section).
Our visitor accepts an undefined number of arguments. It allows us to pass as many builders as we want. The first parameter is the number of builders. Like we will see, it's easy to write your own builder and the integration is straightfoward.
Like we will see in the analysis part, we need a control flow graph (CFG) to implement iterative algorithm on it. It is the visitor which is in charge of the construction of the CFG. We don't want explain the basics now because the extraction of the CFG will be studied in details in further section.