[antlr-interest] Global scope syntax and the C# target

Johannes Luber jaluber at gmx.de
Wed Sep 19 04:01:06 PDT 2007


Gavin Lambert wrote:
> At 09:56 19/09/2007, Johannes Luber wrote:
>>I'm trying to access the stack size of a global scope, but it seems
>>that my syntax is wrong. "$RuleScope.size()" isn't translated, neither
>>"$RuleScope.Size()" nor "$RuleScope.Size". What should I use?
> 
> http://www.antlr.org/wiki/display/ANTLR3/Special+symbols+in+actions
> 
> To access things in the scope you need double-colons.  I'm not sure if
> you can get the stack size, though.  That may depend on your target
> language.
> 
The first example is by the book. That the C# target doesn't have one,
can't be true. Your link gave me the right idea, though. As I wanted to
simulate "$RuleScope[-1]" I used this syntax instead and discovered,
that in C# instead "size()" "Count" is used. No mentioning of this on
the C# target page, so I added it.

Best regards,
Johannes Luber


More information about the antlr-interest mailing list