[antlr-interest] Problems using the command-line grammar interpreter
Kay Roepke
kroepke at classdump.org
Sat Oct 14 05:52:06 PDT 2006
On 14. Oct 2006, at 14:42 Uhr, Brian DeVries wrote:
> % java -cp ${HOME}/classpath/antlr-2.7.6.jar:${HOME}/classpath/
> antlr_mine.jar:${HOME}/classpath/stringtemplate-2.3b9.jar
> org.antlr.tool.Interp Pseudocode2.g WS assign ../test.slpc
Wouldn't you have to say
org.antlr.tool.Interp Pseudocode2.g 'WS ASSIGN' ../test.slpc
?
you cannot ignore parser rules, only tokens (assign vs. ASSIGN) and I
think you have to supply the tokens to ignore in a string, thus the
single quotes on the command line.
> I get the output
>
> (<grammar Pseudocode> (assign (variable [@0,0:0='x',<5>,1:0])
> [@2,2:3=':=',<4>,1:2] (expression
> FailedPredicateException(expression,{synpred1}?))))
>
>
> Any ideas why it's throwing an exception here, but not in the
> regular Java code?
How does the input file look like?
HTH,
-k
More information about the antlr-interest
mailing list