7.2 Lexical Tie-ins

One way to handle context-dependency is the lexical tie-in: a flag
which is set by Bison actions, whose purpose is to alter the way tokens are
parsed.

For example, suppose we have a language vaguely like C, but with a special
construct ‘hex (hex-expr)’. After the keyword hex comes
an expression in parentheses in which all integers are hexadecimal. In
particular, the token ‘a1b’ must be treated as an integer rather than
as an identifier if it appears in that context. Here is how you can do it: