For C# projects, you can integrate ANTLR with Visual Studio 2005/2008 by pasting the following snippet of XML near the end of your .csproj file. The <Target>-Tag must appear before <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/> for the Build to run successfully. Adjust the Included and OutputFiles to fit your project.
With ANTLR 3.0, there are some minor integration issues. Sometimes error messages have an empty "location" string, so Visual Studio will not detect the error. Also, it is possible for ANTLR to generate the output file successfully even though your grammar has errors in it. When this happens, the grammar will not be recompiled until it is edited again (since the output is more recent than the grammar).
C/C++ .rules Files for Visual Studio
The C runtime distribution - use the 3.1 distribution, which you may need to get from the latest interim build at the time of writing - comes with a set of .rules files, which you can add in to your Visual Studio configuration. When you add a .g file to your Visual Studio project, it will ask you which rule file you wish to use. Note that you must tell Visual Studio whether this is a lexer only, parser only, parser+lexer, or tree grammar (you can change it later if you get this wrong).
Right clicking on a .g file in solution explorer and selecting properties will allow you to configure any of the antlr command line options to suit your needs. The defaults are usually fine, but you may wish to configure the output and lib directories to conform to the usual layouts of directories that Visual Studio assumes, and -Xconversiontimeout is useful for more complicated grammars. The base directory will be the .vcproj directory and so your output may or may not be in this directory (do you store your .g files in the same directory as the .vcproj file basically).
The examples solution (C.sln), which is part of the downloadable examples tar/zip on the main ANTLR downloads page, uses this technique to build the ANTLR grammars, if you are looking for some examples. Look under the C subdirectory for the C target examples.
These .rules files only work for the C target.
Eclipse 3.3+ for Antlr 3.x
AntlrDT is a standard Eclipse plugin implementing an Antlr 3.1+ specific grammar editor, outline, and builder. Also includes a StringTemplate group file editor and outline view.
Navigate to File->Settings->IDE Settings->Plugins and install the "ANTLRWorks" plugin.
A plugin that provides some support for editing ANTLR v3 grammar files is available from the NetBeans Plugin Portal. The author notes that the plugin supports the following while editing: Coloring, Code folding, Code completion, Hyperlink, Mark Occurrences, Navigator.
The plugin does not provide direct support for generating Java source files, nor compiling those files, however NetBeans uses an Ant-based build system, therefore support for these operations can be added to individual projects. This functionality is added by editing the build.xml file for the project (available from the "Files" tab).
Adding Build and Clean Support to an Individual Project
This is one possible method of adding support for ANTLR v3 to an individual project. Those who are familiar with Ant build scripts and the Netbeans build chain can modify this to suit their own needs.
NetBeans (this solution was tested on version 6.5)
First, download the ANTLR v3 Ant task and copy the task's antlr3.jar file into the NetBeansInstallDir/java2/ant/lib directory, where NetBeansInstallDir is the directory where NetBeans is installed (e.g. C:\Program Files\NetBeans 6.5 on a Windows system).
Next, download the Ant-contrib tasks and copy the ant-contrib-1.0b3.jar to the same directory as above.
Next, start NetBeans, and open the project that you'd like to add ANTLR support to. Click on the "Files" tab, and find the build.xml file. Double click to open it. Be careful not to change anything at the top of this file, especially the contents of the <project> and <import> tags. Scroll down past the comments, and find the closing </project> tag. Add the following above the closing </project> tag, but below the closing comment tag (-->). In the first three lines, below, replace AntlrInstallDir with the location of your ANTLR installation (e.g., mine is C:\java\antlr-3.1.2).
The above integrates with the regular Java build/clean cycle in NetBeans. Execute the IDE's build operation, and the grammar file(s) will be passed through the ANTLR tool to generate the necessary Java code prior to the compile step. You can access the build operation either from the "Run" menu, by pressing <F11>, or by right-clicking on the project in the "Projects" tab, and selecting "Build" from the contect menu. You can also right-click a package and choose "Compile Package" to generate and compile for a single package. Context menu support is not available for the grammar file itself, unfortunately.
The IDE's clean operation will remove all generated .java and .tokens files, and it will also remove files generated from an ANTLRWorks debug session. The latter allows you to use both NetBeans and ANTLRWorks together on a grammar file, and when ready, clean and build from NetBeans. If your grammar file is named grammarFilename.g, then the following files and subdirectories will be deleted (if they exist) from the directory that contains the grammar file, when you invoke the clean operation:
_Test_.java (created from an ANTLRWorks debug session)
_Test_input.txt (created from an ANTLRWorks debug session)
classes directory found below the directory that grammarFilename.g is found in (created from an ANTLRWorks debug session)
The clean operation is accessed by pressing <Shift>-<F11> (for a clean and build in one step), selecting "Clean and Build" from the "Run" menu, or "Clean" (or "Clean and Build") from the project's context menu. You can control what does and does not get deleted by modifying the -post-clean target in the above example (requires knowledge of Ant build script syntax).