Contrary to the visitor, the builder is generic. We try to program it with objects paradigms and we try to follow the builder design pattern. We proceed in this way in order to make the integration of new analyses as easy as possible. So, we have a structure which contains many pointers to functions. Those pointers will be called by the visitor and, we have for each builder a constructor that will link the pointers to "virtual" functions with the real builder functions. Moreover, the structure contains fields making it possible to the programmer to specify some proper values which it will need to store the data during build.
As we can see in Figure 3, there is two structures defined in "builder.h". The structure buildParam will contain the name of the builder and, a pointer to attributes. Those attributes are defined by the programmer and, he can put everything he needs in the structure. For example, our first builder (asciiBuilder) just writes statement in a file so, we need to store the file in the structure and we do that like shown in Figure 4.
Inside the template file, you will find the skeleton to write your own builder. The file "templateBuilder.c" contains a constructor, a desctructor and all functions that are called by the visitor. In fact those functions are not directly called by the visitor but, the constructor initializes the function called by visitor with the adress of the functions found inside the template file (see Figure 6).
The file "templateBuilder.h" just have one structure declaration which can correspond to the attributes of your object.