AntlrDT

An Eclipse plugin that contributes ANTLR V4 grammar editor and builder to the Eclipse platform.


Features

  • Antlr Editor and Outline View – full syntax-directed editor
  • Grammar Formatter
    • Antlr elements handled using custom formatter
    • Java elements are handled using the JDT platform formatter
  • Grammar Builder – incremental Lexer/Parser generator
  • Parse tree view – visualization of dynamically generated parse tree
    • includes tokens list and full parser/lexer errors list
  • Rule paths view – visualization of connection paths between rules

Screen Shot

Expr.g4 grammar -- parse tree generated from source input

Use

  • automatically associated with ANTLR4 grammars (“.g4”)
  • available in any Eclipse project (native code features only available in Java projects)
  • the builder requires a package header in the grammar – required to determine build destination
    • build destination must be a package in a source folder of the containing project
  • the formatter is invoked using the standard platform format command (ctrl-shift-f)
    • should only modify whitespace – ctrl-z will undo changes
    • the sophistication of the formatter is evolving

Parse Tree View

  • the parse tree is built from a full live execution of the parser.
  • the generated tree will reflect the true exection of the grammar, including custom Token, TokenFactory and ErrorStrategy implementations.
  • Requires a split parser and lexer grammar that generates without errors.
  • The grammar code gen directory must be on the project build path.
  • Superclass and any helper classes referenced by the grammar generated code must be properly on the project build path.
  • Have the Antlr grammar (lexer or parser) open in the active editor window.
  • Open the Tokens view tokens view from the platform toolbar platform toolbar .
  • Check and update the integration parameters. A token factory is required if execution of the parser relies on custom tokens. The factory supplied must have a valid no-arg constructor.
  • Select a file continaing the source data to be parsed
  • The parse tree display will open automatically on a successful parser generation and run.

Rule Paths View

  • Performs a rule connectivity analysis relative to any selected rule
    • identifies all possible paths from the start rule to the selected rule
    • start rule is presumed to be the first listed rule in the grammar
  • Open the Paths view paths view from the platform toolbar platform toolbar .
    • the view is an ordinary Eclipse editor window - position as desired.
  • Have a parser or combined grammar open in the active editor window.
  • Select a grammar rule from the platform Outline view
  • The paths view will automatically display the connectivity graph.

Requirements

  • Eclipse 4.5.2 on Java 8 JDK VM
  • Eclipse Zest Visualization Toolkit 1.5

License

Eclipse Public License v1.0