You are correct, GPPG range checks symbolic expressions within semantic actions to ensure that they resolve to a valid symbol in the production right-hand-side.
I realize that some parser generators allow zero or negative symbols to access semantic values (or location markers) further down the push-down stack. Sometimes this can be useful, but is a little tricky. There is the classic result, due to Knuth if
my memory hasn't tricked me, that the "viable prefixes" for any given reduction are given by a regular expression. This is why it is possible to use a finite state automaton to recognize these prefixes. However this means that you only
have certainty as to what is on the stack below the current right-hand-side in the special case that the language of viable prefixes for that particular production all end with the same symbol or symbols.
Nevertheless, if it is useful on occasion I am reluctant to ban the practice outright. I could either (1) make a failed bounds check into a warning rather than an error, or (2) invent a command-line option that says "let me use zero and negative
I have an update ready to upload soon (the source is already in the repository) so I could incorporate this change as well if I get encouragement.
Ummm, and sorry to those readers who understand all of this technical detail already. I don't want to teach my Grandma to suck eggs, but I do want the explanation to be clear to all the readers.