How to resolve conflict between two choices starting with same tokens in javacc
问题 I'm trying to write a compiler for some specific format of messages. My problem if I simplify it is: < WORD : ([LETTER]){2,5}> < ANOTHER_WORD : (<LETTER>|<DIGIT>){1,5}> < SPECIAL_WORLD : "START"> void grammar(): { } { <WORD><ANOTHER_WORD> | <SPECIAL_WORD><ANOTHER_WORD> } Here my special word is matched always as a WORD which is logical of course but since the conflict is at the beginning of the production I don't know how to resolve it. some help would be appreciated. 回答1: Put the rule for