Home » Netbeans » Netbeans – How to edit ANTLR grammars and create its classes automatically

Netbeans – How to edit ANTLR grammars and create its classes automatically

If you are working with language development and wants to use the new Netbeans 8 you can now download the new ANTLRWorksEditor Plugin

To do that follow the steps :

  1. Open the plugins windows  Tools/Plugins
  2. Click in the name column to sort by plugin name. If the plugin ANTLRWorks Editor does not appear try to click at the button “Check for Newest
  3. Select the pluginAntlrWorks-plugin
  4. Click on install button.
  5. Accept the license and click on continue button.

After the plugin is installed

Netbeans 8 with antlrworks plugin

you now can create a file with the extension .g4 and see the plugin working. It will bring you to g4 files the syntax check and highlighting.

The plugin brings a very useful window to graphically show the syntax of your  rules. Click on menu Window / Syntax Diagram.

The Netbeans Navigator window will now show specific information for the g4 files .

How get the ANTLR classes created automatically

If you want to have netbeans generating the ANTLR classes automatically, just follow the simple steps below.

Open your project folder and locate the build.xml file . Open it with a text editor (or just drag the file to Netbeans and use it)

Insert the snippet code  in your build.xml file above the </project> tag.

build.xml sample after change:


  1. http://plugins.netbeans.org/plugin/53652/antlrworks-2
  2. ANTLR 4.x.x
8393 Total 1 Visualizações


System development consultant
He graduated from UFF in Software development
A lot of experience in development process and management .
International expertise : USA (1 yr) and Italy (3 yrs) where He played as system team leader .
Fluently in italian and english.
He Lives now in Rio de Janeiro, Brazil

    Find more about me on:
  • googleplus
  • Rick Raymond

    Simple and Great !

  • Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! However, how could we communicate?
    ugg australia neumel http://www.shaysp….

    • admin

      You can send me an email to marcelo.aleks_AT_gmail.com

  • I love it when individuals get together and share ideas. Great blog, keep it up!
    ugg australia instagram giveaway http://www.runlong

    • Marcelo Aleksandravicius

      Thank you so much !