After creating the Hello.g4 sample grammar (see next)
grammar hello; // define a grammar called Hello
r : 'hello' ID; // match keyword 'hello' followed by an identifier
ID : [a-z]+; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; //skip spaces, tables, newlines, \r (Windows) I generated and compiled the Java
I generated and compiled the Java code:
Hello.g4
Hello.tokens
HelloBaseListener.class
HelloBaseListener.java
HelloLexer.class
HelloLexer.java
HelloLexer.tokens
HelloListener.class
HelloListener.java
HelloParser$RContext.class
HelloParser.class
HelloParser.java
When I run grun from within the above directory, it gives an error message: "Can't load Hello as lexer or parser"
. . . . . . .
In addition, running grun with no parameters, does more than what the book says: It prints the usage messages *and* a NullPointerException stack trace:
TestRig.main ->
TestRig.process ->
java.lang.ClassLoader.loadClass ->
sun.misc.Launcher.$AppClassLoader.loadClass
I'm running on Windows 7 Ultimate x86, 4GB RAM, 8 cores.
What needs to be fixe? TIA
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.