[antlr-interest] Using the ANTLRworks Debugger

Terence Parr parrt at cs.usfca.edu
Sun Nov 19 13:49:25 PST 2006


Hmm...Is TSTPLexer.java on the disk? the compiler saying that the  
generated lexer is not there.
Ter
On Nov 19, 2006, at 1:38 PM, Randall R Schulz wrote:

> On Sunday 19 November 2006 13:30, Terence Parr wrote:
>> On Nov 19, 2006, at 1:26 PM, Randall R Schulz wrote:
>> ...
>>
>>> I guess I keep applying parser-rule thinking to lexer rules.
>>
>> Yup ;) knowing where to draw the line is often difficult.
>>
>> Ter
>
>
> So, to wrap up and tie this all back to the original report, I  
> still get
> a failure when using the debugger in ANTLRworks:
>
> [13:31:03] Note: /dar/tau/src/tau/tstp/TSTPParser.java uses  
> unchecked or unsafe operations.
> [13:31:03] Note: Recompile with -Xlint:unchecked for details.
> [13:31:06] /dar/tau/src/tau/tstp/__Test__.java:9: cannot find symbol
> [13:31:06] symbol  : class TSTPLexer
> [13:31:06] location: class __Test__
> [13:31:06]         TSTPLexer lex = new TSTPLexer(new ANTLRFileStream 
> ("/dar/tau/src/tau/tstp/__Test___input.txt"));
> [13:31:06]         ^
> [13:31:06] /dar/tau/src/tau/tstp/__Test__.java:9: cannot find symbol
> [13:31:06] symbol  : class TSTPLexer
> [13:31:06] location: class __Test__
> [13:31:06]         TSTPLexer lex = new TSTPLexer(new ANTLRFileStream 
> ("/dar/tau/src/tau/tstp/__Test___input.txt"));
> [13:31:06]                             ^
> [13:31:06] /dar/tau/src/tau/tstp/__Test__.java:12: cannot find symbol
> [13:31:06] symbol  : class TSTPParser
> [13:31:06] location: class __Test__
> [13:31:06]         TSTPParser g = new TSTPParser(tokens);
> [13:31:06]         ^
> [13:31:06] /dar/tau/src/tau/tstp/__Test__.java:12: cannot find symbol
> [13:31:06] symbol  : class TSTPParser
> [13:31:06] location: class __Test__
> [13:31:06]         TSTPParser g = new TSTPParser(tokens);
> [13:31:06]                            ^
> [13:31:06] 4 errors
>
>
> But I have accidentally discovered the problem. Because ANTLRworks  
> left
> __Test__.java in the same directory as my other source files  
> (because I
> made that the start directory associated with the desktop icon I  
> set up
> to launch it) and I then ran my Ant build, I got the same error  
> when it
> tried, in its usual megalomaniac way, to compile ever .java file
> present. So I looked at that file and see that the problem is that it
> lacks a package declaration and / or imports for the Parser and Lexer
> classes:
>
> import java.io.*;
> import org.antlr.runtime.*;
>
> public class __Test__ {
>
>     public static void main(String args[]) throws Exception {
>         //System.out.println("Parser launched");
>
>         TSTPLexer lex = new TSTPLexer(new ANTLRFileStream("/dar/tau/ 
> src/tau/tstp/__Test___input.txt"));
>         CommonTokenStream tokens = new CommonTokenStream(lex);
>
>         TSTPParser g = new TSTPParser(tokens);
>
>         try {
>             g.tptpUnit();
>         } catch (RecognitionException e) {
>             e.printStackTrace();
>         }
>
>         //System.out.println("Parser stopped");
>     }
> }



More information about the antlr-interest mailing list