Skip to content

Installation

Sam Harwell edited this page Nov 2, 2013 · 8 revisions

Getting Started

Step 1: Install Java

The C# target for ANTLR 4 requires Java for compiling applications. The resulting compiled C# applications will not require Java to be installed (at least not due to the use of ANTLR 4). You can install any of the following versions of Java to use this target.

If you already have one of the following installed, you should check to make sure the installation is up-to-date.

  • Java 7 runtime environment (x86 or x64)
  • Java 7 development kit (x86 or x64, provided that the JRE option is also installed during the development kit installation)
  • Java 6 runtime environment (x86 or x64)
  • Java 6 development kit (x86 or x64, provided that the JRE option is also installed during the development kit installation)

Step 2: Install ANTLR Language Support for Visual Studio (optional)

This step is optional, but highly recommended for users working with a version of Visual Studio that the extension supports. If you have one of the Express Editions of Visual Studio, or would like to skip this step, move on to the following step.

  1. Open Visual Studio
  2. Select ToolsExtensions and Updates...
  3. In the left pane, select Online
  4. In the top right, type ANTLR to search for extensions
  5. If your version of Visual Studio is supported, the results pane will show the extension ANTLR Language Support by Sam Harwell. You can click the result and then select Download to install the extension.
  6. Restart Visual Studio after installing the extension

Step 3: Update the NuGet Package Manager

For nearly all Visual Studio 2010 and newer installations

  1. Open Visual Studio
  2. Select ToolsExtensions and Updates...
  3. In the left pane, select Updates, then select Product Updates
  4. Wait for ~10 seconds while the application checks for updates (it might not notify you that it's checking in the background)
  5. If an update for NuGet Package Manager is listed in the results, click to update it
  6. Repeat steps 3-5 for any other sections listed under Updates in the left pane
  7. If you updated NuGet, restart Visual Studio before continuing to Step 4 below

For Visual Studio 2008, and Visual C# 2010 Express Edition

These versions of Visual Studio do not support the NuGet Package Manager extension, but the C# target for ANTLR 4 does support .NET 2.0 and higher so you should be able to use the command line NuGet utility instead of working directly within Visual Studio.

Step 4: Install ANTLR 4 support in a C# project

For nearly all Visual Studio 2010 and newer installations

  1. Create or open a C# project which will use ANTLR
  2. Right click the top-level solution node in the Solution Explorer window and select Manage NuGet Packages for Solution...
  3. In the left pane, select Online, then select nuget.org
  4. At the top of the middle pane, if a drop down says Stable Only, change the selection to Include Prerelease
  5. In the top right, type Antlr4 to search for the package
  6. In the search results, locate and select the package called ANTLR 4. In the right pane, verify that the Id is listed as exactly Antlr4.
  7. Click install on the search result
  8. Select the C# projects you want to add support for ANTLR 4 to, and click OK to update those projects

For Visual C# 2010 Express Edition

TODO: This section needs more detail.

Use the NuGet Package Manager Console to install the latest version of the Antlr4 package, as described on the following page.

ANTLR 4

For Visual Studio 2008

TODO: This section needs more detail.

A special NuGet package is available for installation in Visual Studio 2008 projects. You should be able to use the NuGet Package Manager Console to install the latest version of the Antlr4.VS2008 package, as described on the following page.

ANTLR 4 (Visual Studio 2008)

Working with ANTLR 4 in Visual Studio

The sections below may be performed multiple times in any order as necessary to add and configure the grammars used in your project.

Add a new grammar to the project

Using templates provided by the ANTLR Language Support extension

TODO

Without using the ANTLR Language Support extension

TODO

Add an existing grammar to the project

Using the ANTLR Language Support extension

TODO

Without using the ANTLR Language Support extension

TODO

Configure the compile-time options for a grammar in the project

Using the ANTLR Language Support extension

TODO

Manually editing the project file

TODO

Clone this wiki locally