Sam, hey, so I might have bumped into a code gen bug. I'm trying to access a
variable "skipSection" on the parent production of "pp_conditional". It
looks like the generated code is doing some computation involving the stack
count when really it should just pass my index without any calculation. For
example, below, shouldn't the highlighted code simply be my index? Or am I
missing something? Looks like the highlighted code is assuming TOS is Count
- 1 (like it would be with a stack implemented with a List<T>) but I don't
think that's the case. The stack is a System.Collections.Generic.Stack<T>
which maintains that TOS is always index 0.

$pp_conditional[1]::skipSection

The code above is transformed to:


System.Linq.Enumerable.ElementAt(pp_conditional_stack,
pp_conditional_stack.Count-1-1).skipSection;


Also, you may want to ensure that all user expressions are enclosed in
parens. As I was trying to work around this issue I used "count -2" which
got translated to stack.Count-count -2 -1. I had to add the parens to get it
to be stack.Count-(count -2) -1.

Thanks,
Chris

On Thu, Aug 4, 2011 at 6:00 PM, chris king <[email protected]> wrote:

> Ok. Thanks for looking into it.
>
>
> On Thu, Aug 4, 2011 at 5:56 PM, Sam Harwell 
> <[email protected]>wrote:
>
>> I did, and I can repro the issue but I haven’t resolved it yet.****
>>
>> ** **
>>
>> Sam****
>>
>> ** **
>>
>> *From:* chris king [mailto:[email protected]]
>> *Sent:* Thursday, August 04, 2011 6:48 PM
>> *To:* Sam Harwell
>> *Cc:* [email protected]
>> *Subject:* Re: [antlr-interest] To Sam Harwell****
>>
>> ** **
>>
>> Awesome! I'll give it try. Did you see my follow up email that the parse
>> string is 5 characters (there is a trailing space)? "/**/ " ****
>>
>> ** **
>>
>> And again, love the tool chain. I only really started to get traction on
>> my project after I installed it. It's working great.****
>>
>> ** **
>>
>> Thanks,
>> Chris****
>>
>> ** **
>>
>> On Thu, Aug 4, 2011 at 4:34 PM, Sam Harwell <[email protected]>
>> wrote:****
>>
>> Hi Chris,
>>
>> In build 3.4.1.9004 that I released today, I switched all the projects to
>> using $(ProjectDir) with relative paths.
>>
>> http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases****
>>
>>
>> Sam
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of chris king
>> Sent: Monday, July 25, 2011 6:39 PM
>> To: [email protected]
>> Subject: [antlr-interest] To Sam Harwell****
>>
>> Sam, hey, hope this finds you. Very small suggestion follows :). In
>> Antlr3.StringTemplate.csproj could you use
>>
>>
>>
>> <AntlrBuildTaskPath>$(MSBuildProjectDirectory)\..\bin\Bootstrap</AntlrBuildT
>> askPath>
>>
>> to reference the bootstrap directory? Originally it used the solutionDir
>> and
>> that prevented me from including a subset of the projects in my project
>> (so
>> I could simply reference them and have all the debugging, pdb, source, etc
>> just work).
>>
>> Thanks,
>> Chris****
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address***
>> *
>>
>> ** **
>>
>
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to