I am trying to test an ANTLR grammar with such a standard test rig
import org.antlr.runtime.*;
class Main {
public static void main(String[] args) throws Exception {
SampleLexer lexer = new SampleLexer(new ANTLRStringStream(args[0]));
SampleParser parser = new SampleParser(new CommonTokenStream(lexer));
parser.program();
}
}
I have a test file called mytest00. Now I want to use this file as input. I suppose I am doing a stardard IO redirection here.
bash-3.2$ java Main < mytest00
But it gives me such an error message. What is the problem please? Thanks.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Main.main(SampleTest.java:5)