[antlr-interest] Visual Studio plugin for ANTLR grammar files

Sam Harwell sharwell at pixelminegames.com
Fri Apr 2 08:33:11 PDT 2010


It didn't need any changes to work with C# projects with 2010. I'm using
it for my experimental language support in 2010. C code poses an
interesting problem of include directories. Perhaps you can output them
to:

$(IntermediateOutputDir)\Antlr\[GrammarName]\[GrammarName.h]

And then have it add obj\Debug\Antlr to the #include search directories.

The AntlrBuildTasks.dll MSBuild tasks assembly will be the same for the
CSharp3 and C targets. However, a new Antlr3.C.targets file or similar
will probably be much easier to maintain than a shared one for multiple
languages.

I'll try to put up a new build within the next couple days so people can
try this with more projects.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: Friday, April 02, 2010 10:16 AM
To: ANTLR Interest
Subject: Re: [antlr-interest] Visual Studio plugin for ANTLR grammar
files

Did you updates this for VS2010 yet Sam? The C build system seems to use
MSBUILD in vs2010 to, so I would suggest that we take your code out of
the C# specific tree and my vs2008 C build rule files out of the C tree
and create a buildsystems tree or something similar.  I (or you if you
prefer to own it) can then adapt your current integration to select
between C or C# on vs201, as my feeling is that the will be very similar
(other htan I have a header file to deal with as well).

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Sam Harwell
> Sent: Thursday, April 01, 2010 10:34 PM
> To: Shawn Poulson; ANTLR Interest
> Subject: Re: [antlr-interest] Visual Studio plugin for ANTLR grammar
> files
> 
> Hi Shawn,
> 
> I went the route of tying it into MSBuild. The generated file is
placed
> in the intermediate output directory (often obj\Debug or obj\Release).
> This system properly handles dependent grammars (eg. tree grammars are
> automatically recompiled when the lexer defining the tokens is
> recompiled). The latest source is in source control as the
> AntlrBuildTask project that's part of the C# 3 port. I still need to
> post an updated set of binaries for it since I fixed several bugs.
> 
> Sam
> 
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Shawn Poulson
> Sent: Thursday, April 01, 2010 6:36 PM
> To: ANTLR Interest
> Subject: [antlr-interest] Visual Studio plugin for ANTLR grammar files
> 
> Hello all,
> 
> 
> 
> I've been working on and off with ANTLR over the past couple years and
> one
> thing that always got me, not being a Java developer, was trying to
> remember
> how to call ANTLR to compile my grammars to C#.  Moreover, I really
> wanted
> it to be part of Visual Studio so that it generated code from the
> grammar on
> change, like a Makefile.  I searched around and couldn't find any such
> tool
> that already existed.
> 
> 
> 
> Visual Studio has an API that allows you to create your own code
> generators,
> so I took a shot at it.  I have a working proof of concept that works
> as
> you
> would expect.  The generated code files are seen as child nodes
hanging
> off
> the grammar file.  I was curious if anyone were willing to give it a
> shot
> and let me know how it works for them.  I'd like to package it up into
> an
> installer and put the source up on something like github or ohloh.
Any
> input would be greatly appreciated.
> 
> 
> 
> ---
> 
> Shawn Poulson
> 
> spoulson at explodingcoder.com
> 
> 
> 
> 
> 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




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


More information about the antlr-interest mailing list