Javacc: two tokens have the same definition ?



Hi everyone !

I use JTB/JavaCC to developpe a compiler for my language.

I have a trivial JavaCC problem which is blocking me from otherwise
having a JTB/JavaCC
solution.

In the grammar specification rules, i have two tokens which have the
same definition.
....
TOKEN:{
<#IDENT: ["A"-"Z"](["a"-"z","A"-"Z","0"-"9","-","_"])*>
| <IdentTypeA: <IDENT> >
| <IdentTypeB: <IDENT> >
}
....

In spite of having the same definition, I would like to keep theses
two tokens.

JTB and JavaCC read and generate files without problem.
And IdenTypeA is well defined but not for IdentTypeB.

This problem is some kind of "First declared Firs Defined".
(Yes it's true that the rule that appears first in the specification
file has priority)

Do you have any idea of this problem ?
Is there a way to get around this problem ?

Thank

Best regards
Link
.



Relevant Pages

  • Javacc: two tokens have the same definition ?
    ... I use JTB/JavaCC to developpe a compiler for my language. ... I have a trivial JavaCC problem which is blocking me from otherwise ... i have two tokens which have the ... This problem is some kind of "First declared Firs Defined". ...
    (comp.compilers.tools.javacc)
  • Re: Javacc: two tokens have the same definition ?
    ... I use JTB/JavaCC to developpe a compiler for my language. ... I have a trivial JavaCC problem which is blocking me from otherwise ... In the grammar specification rules, i have two tokens which have the ...
    (comp.compilers.tools.javacc)