[antlr-interest] StringTemplate and Antrl3.runtime version mess on C# target

Sam Harwell sharwell at pixelminegames.com
Fri Nov 4 13:20:21 PDT 2011


I went ahead and edited the description of the Bootstrap release. Can you
check it and let me know if it makes things more clear?

 

Thanks,

Sam

 

From: Voelkel, Andy [mailto:andy.voelkel at plantronics.com] 
Sent: Friday, November 04, 2011 3:01 PM
To: Sam Harwell; antlr-interest at antlr.org
Cc: 'Eric'
Subject: RE: StringTemplate and Antrl3.runtime version mess on C# target

 

I see. I originally got the "bootstrap" release, which does not include ST3.
Then when I went to get ST3 after I discovered I needed it for Antlr
generated StringTemplate code, I got it from the StringTemplate website.
Hence the incompatibility.

 

Would you mind if I edited the Wiki Page for the C# target to make all of
this a little more clear to the uninitiated? 

 

-          Andy

 

 

From: Sam Harwell [mailto:sharwell at pixelminegames.com] 
Sent: Friday, November 04, 2011 12:14 PM
To: Voelkel, Andy; antlr-interest at antlr.org
Cc: 'Eric'
Subject: RE: StringTemplate and Antrl3.runtime version mess on C# target

 

Hi Andy,

 

The Antlr3.Runtime.dll included in all of the packages is exactly the same.
It's used by ST3, ST4, the Tool, and the generated grammars for both the
CSharp2 and CSharp3 targets.

http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases

 

Sam

 

From: Voelkel, Andy [mailto:andy.voelkel at plantronics.com] 
Sent: Friday, November 04, 2011 1:51 PM
To: antlr-interest at antlr.org
Cc: Eric; Sam Harwell (sharwell at pixelminegames.com)
Subject: StringTemplate and Antrl3.runtime version mess on C# target

 

I've done some further investigation on this problem, and it seems that it
wasn't quite what I thought it was. As I suspected, it was connected to my
recent efforts to use Antlr generated StringTemplate code. I hadn't done
this previously because Antlr3.4 uses StringTemplate 4 for its own purposes,
but generates code that expects to use StringTemplate 3 if you use Antlr to
StringTemplate integration.

The problem is that I apparently need a different version of
Antlr3.Runtime.dll to run the C# code generated by Antlr3.exe than I need to
run StringTemplate 3, which that same generated code expects to use.

I got the version of Antlr3.Runtime.dll that StringTemplate3 expects from
the StringTemplate site, and tried to add that to my project along with the
version of Antlr.Runtime.dll that the generated C# code expects, but Visual
Studio doesn't like it.

What a mess! How do I resolve this? And I'm mystified, since it seems that
anyone who tries to use the latest version of the C# target and also wants
to have Antlr generate StringTemplate code will run into this problem.

-       Andy

 

On Fri, Nov 4, 2011 at 1:13 PM, Voelkel, Andy <andy.voelkel at plantronics.com>
wrote:

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-Te
mplates-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.

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.

 

  _____  


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