[antlr-interest] AntLRWorks Rule Debugging Error

John B. Brodie jbb at acm.org
Tue Mar 9 15:38:47 PST 2010


Greetings!

On Tue, 2010-03-09 at 14:11 -0800, Rahul Mehta wrote:
> I am trying to test "whenDescriptor" rule in following grammar 
> in AntLRWorks. I keep getting following exception as soon as I start 
> debugging. Input text for testing is "when order : OrderBll then"
> 
> [16:45:07] C:\Documents and Settings\RM\My Documents\My 
> Tools\AntLRWorks\output\__Test__.java:14: cannot find symbol
__________________________^^^^^^^^^^^^^

> [16:45:07] symbol  : method whenDescriptor()
> [16:45:07] location: class 
> RulesTranslatorParser
> [16:45:07]             g.whenDescriptor();
> [16:45:07]              ^
> [16:45:07] 1 error
> 
> I am able to test "packageDescriptor" 
> and "declareDescriptor" successfully. Does anyone knows resolution to 
> the error message? I tried various combination of input string but rule debugging fails.
> 
> Here is my grammar.
> 
> grammar RulesTranslator;
> 
> options
> {
>     
> backtrack=true;
>     memoize=true;
>     language=CSharp2;
_______________^^^^^^^

> }
> 
....snipped....
> 
> packageDescriptor
>     : 'package' 
> qualifiedName
>     ;
>     
> declareDescriptorList
>     : (declareDescriptor)*
>     ;
>     
> declareDescriptor
>     : 'declare' qualifiedName 
> (variableDef)+ 'end'
>     ;
>     
> whenDescriptor
>     : 
> //'when' ( typeRef | NOT ) (parExpression)+ 'then'
>      'when' 
> typeRef  'then'
>     ;
>     
....remainder snipped....

I see that your error message refers to the file __Test__.java

Yet you have selected CSharp2 as your target language.

I do not think that the debug button (or whatever it is called, i do not
use ANTLRWorks...) only works for the Java target. Is it possible that
ANTLRWorks is actually using some prior, Java, version of your grammar?

I believe that it is possible to use the ANTLRWorks debugger on CSharp
grammars. But you need to compile, build, and excute the grammar and
generated files by hand. Don't forget the -debug option to
org.antlr.Tool

When you run the -debug version, it will pause waiting for ANTLRWorks to
connect. At that point you can debug from ANTLRWorks.

The above is just the concept, not sure of the exact details, because i
do not use ANTLRWorks nor do i use C#.

Sorry for not being very specific, but maybe, hopefully, this will point
in the right direction.
   -jbb




More information about the antlr-interest mailing list