I started using ANTLR recently and found out about the ANTLRWorks IDE. Although the editor works fine, it seems, however, that when I am running the test rig it gets stuck on compiling grammar files (or rather does nothing with compiled grammar?), regardless of what input I am giving it. Here is the output I am getting:
ANTLR Codegen
Arguments: [-o, C:\Users\\AppData\Local\Temp\TestRigTask-1395567588803, -lib, C:\Users\\Desktop, -no-listener, -no-visitor, C:\Users\\Desktop\Test.g4]
ANTLR Testrig
Compiling grammar files...
Here is the input I am giving it to test the issue:
Grammar
grammar Test;
CUP : 'cup';
MUG : 'mug';
TEA : 'tea';
COFFE: 'coffe';
drinker : 'drinking a' holder 'of' liquid;
holder : MUG | CUP;
liquid : TEA | COFFE;
Test file
drinking a mug of coffe
Am I doing something wrong / missing something important?
Check that you are running ANTLRWorks2 with a JDK rather than just a JRE. ANTLRWorks requires the Java compiler, javac
, in order to compile the grammar to run the test rig and javac
is only included with a JDK and not with the JRE.
ANTLRWorks should be able to find the JDK if installed, but if that is not working you can specify the --jdkhome <path>
argument when launching ANTLRWorks.