This isn’t a big issue, but I was wondering if it was possible to give a token more than one name?
Example:
// C++esque grammar
...
%token dereference *
%token multiply *
...
#dereferenceExpression:
::dereference:: expression()
// Demo-only -- ignore left recursion
#multiplyExpression:
expression() ::multiply:: expression()
I tried something similar, and the .pp file is legal, but only the top token name would never be used. It would be nice to be able to do this for a couple reasons:
- It’s easier to read.
- It slightly reduces work required to change one of the tokens. For example, if you wanted to change
dereference
to@
, you don’t need to change#dereferenceExpression
.