ANTLR

ANTLR Lab

ANTLR lab lets you can learn about ANTLR or experiment with and test grammars without having to install any software.

ANTLR Development Tools

There are plug-ins for Intellij, NetBeans, Eclipse, Visual Studio Code, Visual Studio IDE, and jEdit.

Intellij Plugin for ANTLR 4

We have a ANTLR v4 plugin for Intellij. Videos:

Features:

  • Syntax highlighting and syntax error checking
  • Navigation window
  • Code completion for tokens, rule names
  • Live grammar interpreter for grammar preview
  • Config per grammar, autobuild on save
  • Use the meta-key while moving the mouse and it will show you token information; click on the token that's underlined and it will show the location in the ANTLR grammar editor window of the grammar element that matched that token
  • Meta-j pops up a list of live templates, just like it does for Java programming
  • Ctrl-return, or whatever you have configured for the generate pop-up, will bring up a list of things you can generate
  • Alt-key while moving the mouse shows the region of input associated with parser rule that matched it
  • Clicking at the same time jumps the grammar to the associated rule. A pop up shows the parser call stack leading to that parse region.
  • Sophisticated profiler tab that shows ambiguities, lookahead depth, etc...

Sample usage showing Java grammar to the right.

ANTLRWorks2 and NetBeans Plugin for ANTLR 3 and 4

ANTLRWorks 2. This IDE is a sophisticated editor for ANTLR v3/v4 grammars as well as StringTemplate templates. It can run the ANTLR tool to generate recognizers and can run the TestRig (grun on command line) to test grammars. To integrate ANTLR-generated recognizers into your application, you will still need at least the runtime library.

ANTLR4 IDE Eclipse Plugin for ANTLR 4

Edgar Espina has created an Eclipse plugin for ANTLR v4. Features:

  • Advanced Syntax Highlighting
  • Automatic Code Generation (on save)
  • Manual Code Generation (through External Tools menu)
  • Code Formatter (Ctrl+Shift+F)
  • Syntax Diagrams
  • Advanced Rule Navigation between files (F3 or Ctrl+Click over a rule)
  • Quick fixes

AntlrDT Tools Suite for Eclipse

1. AntlrDT — an ANTLR v4 grammar editor and builder

  • full syntax-directed editor with outline view
  • hyperlinked navigation between rules and rule subterms
  • automatic builder with real-time problem feedback markers
  • ANTLR grammar and Java native code formatter
  • Parse Tree view – graphical visualization of generated parse trees
    • builds parse trees using full (non-interpreted) grammar builds and parsing
    • displays lexed tokens list and full parser/lexer errors list
    • supports use of custom token emitters, token factories, and error strategies
  • Paths view – graphical visualization of rule connectivity paths
    • shows all possible parse paths from the start rule to any other selected rule
    • particularly useful in the design of XVisitor grammars and ANTLR XPaths

2. XVisitorDT — an XVisitor grammar editor and builder

  • full syntax-directed editor with outline view
  • hyperlinked navigation between rules
  • automatic builder with real-time problem feedback markers
  • builder performs automatic visitor code generation
  • utilizes fully symbolic XPath-style rule path references
  • ANTLR grammar and Java native code formatter

3. StringTemplateDT — a StringTemplate v4 template editor

  • full syntax-directed editor with outline view
  • for template ('.st') and template group ('.stg') files

Update site: http://www.certiv.net/updates/

Visual Studio Code plugin for ANTLR 4

Mike Lischke created an ANTLR 4 plug-in for Visual Studio Code. Features:

  • Syntax coloring for ANTLR grammars (.g and .g4 files).
  • An own color theme, which not only includes all the recommended groups, but also some special rules for grammar elements that you don't find in other themes.
  • Parser generation on save.
  • Syntax and some semantic error checking (symbol matching)
  • Quick navigation via ctrl/cmd+click.
  • The symbol list for quick navigation (via shift+ctrl/cmd+O).
  • Hovers (tooltips) with symbol information.
  • Rule reference counts via code lens.
  • Railroad diagrams for all types of rules (parser, lexer, fragment lexer).
  • ATN graphs for all rule types. This is a visualization of the internal ATN that drives lexers + parsers. It uses D3.js for layout and interaction. Nodes can be repositioned with the mouse and you can drag and zoom the image. The transformation and position state is restored when reopening a graph.

Visual Studio IDE extension for ANTLR 4

Ken Domino created an ANTLR 4 extention for Visual Studio 2019. Features:

  • Syntax highlighting for ANTLR grammars (.g and .g4 files).
  • Quick navigation for next and previous rules in grammar.
  • Intellisense command completion and tooltips.
  • Go to def/refs.
  • Go to C# visitor and listener methods, with generation if missing.
  • Reformat using Codebuff.
  • Support for integrated C# parser generation via Antlr Java tool, compile, and debug.
  • Templates for NET Code and Framework Antlr examples.

Visual Studio IDE extension for ANTLR 4

Zev Spitz has created a Visual Studio debugging visualizer that supports Antlr.Runtime.Standard.DLL, as well as the older Antlr.Runtime.DLL. Features:

  • Multiple views: token list, parse tree nodes, source
  • Selection sync across views
  • Targets System.String, BufferedTokenStream, RuleContext, and subclasses
  • Filter by text, whitespace, and/or errors; and by specific token types or rule contexts
  • UI controls can be embedded in third-party applications

jEdit plugin for ANTLR 4

The jEdit editor has a plugin with:

  • Syntax highlighting
  • Code navigation
  • Code generation
  • Error checking

Grun.Net for ANTLR 4

Thaddeus Ryker created a .Net desktop tool for diagnosing/exploring/testing ANTLR 4 grammars that were created with .Net. Features:

  • A mostly feature comparable grun command line tool like the java testrig.
  • A visual analyzer tool named GrunWin with various features:
    • A text editor with defaut syntax highlighting and the ability for users to create targeted custom syntax guides
    • A tab with a list of all generated tokens
    • A tab with a trace view of the parsing
    • An error message window showing you errors based on the test text in the editor
    • A visual graphing tab that graphs all the syntax nodes in the parsed text from the editor
    • A tree view of the nodes next to the graph window allowing you to graph subsets of the tree
    • The ability to select text from the editor by selecting tokens in the list or rules from the graph
    • The ability to select specific tokens or parse rules in the graph based on selected text in the editor