Table of Contents

About

The Idea plugin is a plugin for Idea that install the Antlr tool.

Installation

Create a grammar file with the extension g4 and Idea should propose you to install the Antlr plugin

Options

Right click on your g4 file, you should see the Antlr option.

Idea Antlr Right Click Options

Antlr Recognizer

Antlr Recognizer run antlr.

Default run with the default configuration gives:

antlr4 ^
    -o %ProjectRoot%\gen ^ 
    -listener ^
    -visitor ^
    -lib %ProjectRoot%/src/main/antlr4/com/group/package/lexer ^ # output dir
    %ProjectRoot%src/main/antlr4/grammar.g4

where:

Configure Antlr

The Configure Antlr are the options of antlr

Antlr Idea Options

Test Antlr Rule

Test a rule

Antlr Idea Test Rule

start typing the text to see the tree in the Antlr panel

Antlr Idea Test Rule Panel

Generate

Antlr Generate Intellij