Keywords can be potential problems since they are (generally) not available for use as identifiers. Only those keywords that are defined in ISO 7185 Pascal are unproblematic because no valid program should ever use them as identifiers.
To cope with this problem, GPC does several things:
This is solved by listing these keywords in the new_identifier rule of the parser. This means, first the lexer recognizes them as keywords, then the parser “turns them back” into identifiers. The advantage, compared to explicit enabling and disabling of keywords, is that bison automatically finds the places in which to apply the new_identifier rule, i.e. treat them as plain identifiers.
Of course, there is a catch. Since the keyword tokens are listed in new_identifier, they can conflict with occurrences of the actual keywords (bison will find such cases as S/R or R/R conflicts). Such conflicts have to be sorted out carefully and either removed or left to GLR handling. Fortunately, for many keywords, removing the conflicts turned out quite easy – in some cases no conflicts arose at all.