parser attribute indentStack :: [Integer] action {
  indentStack = [];

parser attribute seenTypes :: [String] action {
  seenTypes = [];


Parser attributes are mutable values available in imperative action blocks during parsing. They are declared as:

parser attribute indentifier :: type action { initialization action };

The initialization block is run before the parser begins. Different parser attributes will initialize in no specific order.



C has a well known parsing problem, for which the canonical solution is to simply remember all declared typedef names, and use this list during parsing to decide if a lexeme is a type name or identifier name.

Parser attributes would be used to remember a list of seen type names, and then disambiguation functions can be used during parsing to pick.