> OK, but it seems to me that sometimes you'll want to translate thetoken strings, and sometimes not.
Yes, that's right. I didn't know about aliases before, but you do not want to translate literal token strings.
It would be nice (TM) if bison could see the difference between STRING (with lexed string "foo") and BOOK, with alias "\book" and lexed string "\book". I had a look yesterday, but it didn't seem obvious to me that this is possible at all. It it were, we have two type of syntax error:
syntax error: unexpected STRING: foo, expected ...
and
syntax error: unexpected \book, expected ...
There is another extension, I would want to see: The error message should really be:
syntax error: unexpected string "...": foo, expected
That is, for some tokens, one want its token value to be written. It suggests a construct like
%token STRING "string" {/* printing action */}
Otherwise, I find it difficult to follow this idea with [un-]translated tokens. Could you help enlighten me?
--
Hans Aberg
