[antlr-interest] C# port binaries (CSharp3 target, StringTemplate, Tool, MSBuild integration)

Sam Harwell sharwell at pixelminegames.com
Mon Nov 2 11:49:53 PST 2009


I've made some fixes since my previous release, so I'm releasing an
updated beta build. I'm very interested in any feedback you may have
about any part of this.

 

http://www.280z28.org/downloads/antlr-dotnet-binaries-3.2.0.6288.7z

 

Since this is hosted on a different site than the original, you can
check the assembly strong names to verify that I built this one with the
same in-house signing keys as the earlier release. :)

 

Contents:

 

*         LICENSE.txt. All code in the C# ports of the Tool and
StringTemplate, plus the CSharp3 target are licensed under the same BSD
3-clause license as their Java counterparts except for the addition of
my name. Other targets are licensed under their own terms so you'll have
to check those separately if they are relevant to you.

*         CSharp3 runtime (Antlr3.Runtime.dll and
Antlr3.Runtime.Debug.dll). You always have to reference
Antlr3.Runtime.dll to use the CSharp3 target. You only need to reference
Antlr3.Runtime.Debug.dll if you build with the -debug or -profile
command line flags.

*         StringTemplate .NET port (Antlr3.StringTemplate.dll). This
depends on both of the CSharp3 runtime DLL's, so include those if you
are using StringTemplate.

*         ANTLR Tool .NET port (Antlr3.exe). Works with the same command
line arguments as the Java version, and should produce nearly identical
output for any given target. All target code generation templates are
updated to the latest version as of earlier today.

*         MSBuild integration (Antlr3.targets, AntlrBuildTask.dll).
Preliminary instructions for using this follows.

*         Symbol files for all binaries (*.pdb).

 

MSBuild Integration Instructions:

 

These instructions definitely work for Visual Studio 2008 C# projects
targeting the CSharp3 runtime (it's how I built all the files you're
downloading). They almost surely work for the CSharp2 target, but I
haven't tried it. They might also work for Visual Studio 2005 or 2010
projects, but again I haven't tried it.

 

Extract the contents of the download to $(SolutionDir)\external\antlr.
For example, if you have the solution file C:\Something\MyProject.sln,
then you would find Antlr3.exe at
C:\Something\external\antlr\tool\Antlr3.exe. (The directions can be
modified to suit if you want to use a different path.)

 

Open your project file (*.csproj) as an XML or plain text file and
locate the line importing Microsoft.CSharp.targets. I've included the
line in the following block of code as a reference point for the
necessary changes - just add the other lines below that point.

 

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

  <!-- Include the following immediately *after* the above import (which
will already exist in the file) -->

  <PropertyGroup>

    <!-- Folder containing AntlrBuildTask.dll -->

 
<AntlrBuildTaskPath>$(SolutionDir)external\antlr\msbuild</AntlrBuildTask
Path>

    <!-- Path to the ANTLR Tool itself. -->

 
<AntlrToolPath>$(SolutionDir)external\antlr\tool\Antlr3.exe</AntlrToolPa
th>

  </PropertyGroup>

  <Import Project="$(SolutionDir)external\antlr\msbuild\Antlr3.targets"
/>

 

When you open the project in Visual Studio, you will be able to select a
.g or .g3 file in the project, select right click > Properties, and
choose Antlr3 as the Build Action. To add a new grammar to the project,
add a new "Text File" with the extension .g or .g3, and set its build
action. You no longer have to manually add grammars by editing the
project file.

 

Finally, make sure you add a reference to the appropriate ANTLR runtime
(CSharp2 or CSharp3).

 

Thank you,

Sam Harwell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091102/f6323352/attachment.html 


More information about the antlr-interest mailing list