Hi, Currently, bison implements both a pure and nonpure parser. The nonpure parser has a collection of variables in global scope and the pure parser has the same collection of global in the local scope.
As I implement the push parser, I'm forced to have the same collection of globals in an ADT. So, there could be several choices taken. First, I would like to know if when using a nonpure parser, if users of bison access those global data variables? It is possible that we could make all 3 options use the ADT. The nonpure parser would then create a global instance of the ADT. Then we could #define the old variables with something like '#define yychar (globalvar->yychar)' to satisfy code that users rely on. The code in yyparse would then change to something like (globalvar->yychar) instead of simply yychar. The pure parser could simply create a static pointer to an instance of the ADT locally in yyparse. The instance could be initialized to NULL. Then the first time it's reached, it could be allocated. The pure parser would still be changed to modify (globalvar->yychar). Finally, the push parser passes in an ADT that was created by the user. This would be the same as the pure parser approach, except the ADT would be owned by the user, not by yyparse. All 3 options would operate on a struct, that groups all the necessary objects. The yyparse function would be modified to deal with the ADT by changing lines like 'yychar' to 'globalvar->yychar'. How does this sound? Any drawbacks? If not, I'm going to begin this shortly. Please give me your advice. Bob Rossi
