ANTLR Installing ANTLR in Visual Studio 2015 (using Nuget)


  1. Open Visual Studio 2015, navigate to Tools → Extensions → Online and search for Antlr. Download the extension ANTLR Language Support (Created by Sam Harwell) and restart Visual Studio.
  2. Create new Console Application Project. Right click on the Solution → Manage Nuget Packages for Solution → Browse (Tab) and search for Antlr4 and install it. Antlr4 Nuget
  3. Add a New Item to your Project by right clicking on it. And look for ANTLR4 Templates. Antlr4 templates
  4. From your ANTLR file (ending .g4) go to File → Advance Save Options and search for Unicode (UTF-8 without signature) - Codepage 65001 and click OK. Thats it. Antlr Advanced Save Options

Test if everything works

  • Create a ANTLR 4 Combined Grammar item and name it Calculator.g4
  • Copy and Paste the Calculator source code from this Github project here: Calculator by Tom Everett
  • Change grammar calculator to grammar Calculator
  • On Solution Explorer → Click on Show All Files.
    Solution Explorer Show All Files
  • Save and Run (Start) the project
  • In Solution Explorer under obj folder you should see cs classes generated like the Visitor and Listener. If this is the case you succeeded. Now you can start working with ANTLR in Visual Studio 2015. ANTLR generated classes