[antlr-interest] Dealing with known bug - not out of the woods!

Voelkel, Andy andy.voelkel at plantronics.com
Fri Nov 4 10:13:50 PDT 2011


I thought I had things working based on the fix below. I ran Antlr, and compiled a project based on its output without error. However, when I try to run the project, I get:

An unhandled exception of type 'System.IO.FileLoadException' occurred in Tree1.exe

Additional information: Could not load file or assembly 'Antlr3.Runtime, Version=3.3.0.7239, Culture=neutral, PublicKeyToken=eb42632606e9261f' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Do I need to somehow rebuild/update the DLL so I can run it? Is it a .NET security thing that refuses to use the modified .stg files? And somehow when Antlr3.exe runs, it get around this?

- Andy


-----Original Message-----
From: Maik Schmidt [mailto:contact at maik-schmidt.de]
Sent: Friday, November 04, 2011 12:21 AM
To: Voelkel, Andy
Subject: Re: [antlr-interest] This should be simple, but I can't find the right syntax (or is it a bug?)

Hi Andy!

This is a know bug. Read
http://antlr.1301665.n2.nabble.com/Problems-with-Tree-Grammars-outputting-Templates-in-C-td6724828.html
to find the solution.

Cheers,
Maik

On Fri, Nov 4, 2011 at 1:59 AM, Voelkel, Andy <andy.voelkel at plantronics.com> wrote:
> Hi,
>
> I'm trying to collect all the StringTemplates created by all instances of one rule (borg) into a StringTemplate for a containing rule (prog). But I can't seem to find the right syntax:
>
> options {
>        output = template;
>        language = CSharp3;
>      tokenVocab=Tree1;
>        ASTLabelType = CommonTree;
> }
>
> public prog
> : (b+=borg)+ -> template(vals = {$b})
> <<
> { // prog
>  <vals; separator = ",">
> }
>>> ;
>
> The syntax I tried above is one many approaches I've tried - none seem to work. Antlr3 runs without error but the code won't compile. I hope the intent is clear, as it is a pretty simple example. I've looked back and forth in Terence's book trying to find something like this, and in the examples, but so far I've struck out. It seems like a very common thing to try to do!
>
> One strange thing is that when I look at the generated code, the list for b (list_b) is declared as List<CommonTree>. But Terence's books says is should be List<StringTemplate> when the output type is template. Later in the generated code, when it tries to add to the list, it tries to create a List<StringTemplate>, which seems right, but causes a compiler error. It almost seems like a bug, but I probably just don't understand.
>
> Can anyone help me with this?
>
> - Andy
>
> ________________________________
>
> CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy at plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.
>
> For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


________________________________

CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy at plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.

For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.


More information about the antlr-interest mailing list