I'm using Antlr v3 and java for a project and all goes well in AntlrWorks, but when I switch to Antlr IDE, the plugin for eclipse, the interpreter cannot match the sentence that I wrote, telling me mismatch. And it seems to me that it cannot recognize the list of words to skip that I've specified in on lexer. However it is the same that works perfectly in AntlrWorks.
Any suggestions?
I've set up the antlr buider in eclipse: Antlr Parser Generator v3.4
This may be a configuration issue. I had several difficulties getting everything to work so, not finding any one place for how to do this, I wrote my own document. Hope this helps.
SAMPLE COMBINED GRAMMAR
grammar test; //must match filename.g
options {
language = Java;
}
@header { //parser
package pkgName; //optional
import java.<whatever you need>.*;
}
@members { //parser
// java code here
}
@lexer::header { //lexer
package pkgName; //optional
import java.<whatever you need>.*;
}
@lexer::members {
// java code here
}
/*------------------------------------------------------------------
* PARSER RULES (convention is all lowercase)
*------------------------------------------------------------------*/
parserule: LEXRULE;
/*------------------------------------------------------------------
* LEXER RULES (convention is all uppercase)
*------------------------------------------------------------------*/
LEXRULE: 'a'..'z';