[antlr-interest] Remote Debugging with C#

Johannes Luber jaluber at gmx.de
Tue Jul 3 10:11:56 PDT 2007


Micheal J wrote:
> Hi,
>
>>> But as I know your other posts, your problem may be much harder ;)
>> I know. I have sometimes the feeling that I'm the pilot of a
>> supersonic aircraft and I still have to push my vehicle by
>> hand. :D But back the topic:
>>
>> You are truly prophetic - I couldn't simply compile the code.
>> Turns out, that the template for C# uses constantly
>> "location" instead "Location". Then
>> "dbg.RecognitionException(nvae);" is used, where no "nvae" is
>> available. Instead I had to replace those occurrences with
>> "nvae_d4s0" and similar (there were really many of those...).
>
> These issues were fixed a while ago. Use the latest "daily" release (or
> build for yourself from depot).

The latest daily release is too old for the fixes. And I had no success
in building my own ANTLR with Eclipse. Is there a wiki page about that
problem already?

>> Then I've got this line:
>>
>> protected ITreeAdaptor adaptor = new DebugTreeAdaptor(dbg,
>> new CommonTreeAdaptor());
>
> The missing context may tell another story but, I don't see *anything*
wrong
> with this line.

The location of dbg. dbg is a member of DebugParser, the parent parent
class. And in Ecma 334 is written:

"A variable initializer for an instance field cannot reference the
instance being created. Thus, it is a compile-time error to reference
*this* in a variable initializer, as it is a compile-time error for a
variable initializer to reference any instance member through a
simple-name."

The simple-name part is violated.

>> It is trying to initialize a member via the non-constructor
>> way with a constructor-only argument, which of course the
>> compiler doesn't know about. I removed the assignment and
>> added in each constructor the line:
>>
>> adaptor = new DebugTreeAdaptor(dbg, new CommonTreeAdaptor());
>>
>> Actually, in the one-parameter constructor I used "null"
>> instead "dbg". It would cause NullReferenceExceptions
>> everywhere, if the TreeAdaptor isn't set afterwards, but that
>> seems to be the consequence anyway, as this constructor
>> chains to the one-argument base constructor (Interestingly,
>> the one-argument constructor has the line
>>
>> ruleMemo = new IDictionary[154+1];
>>
>> but the two-argument constructor does not. I'm further
>> astonished that no constructor chaining is done from the
>> one-argument constructor to the two-argument constructor.)
>
> Do you have a sample grammar that demonstrates what you feel is the
problem
> here?.
>
> I expected you might have sent me a grammar as you did previously.

My apologies. I assumed that my diagnostics would have been enough. I
attached both grammars, as the errors appear in different files. Use the
-debug option for generation.

Best regards,
Johannes Luber

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ANTLR3ToRelaxNGGenerator.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20070703/8fa07e16/attachment-0002.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ANTLR3ToRelaxNG.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20070703/8fa07e16/attachment-0003.pl 


More information about the antlr-interest mailing list