Categories


Authors:
parrt
BSD

ANTLR v4 grammar plugin

Products: IntelliJ IDEA

Vendor: ANTLR Project

Email:

Website: N/A

SourceCode: https://github.com/antlr/intellij-plugin-v4

License: http://antlr.org/license.html

Bugtracker page

Description:

This plugin is for ANTLR v4 grammars. Features: syntax highlighting, syntax error checking, semantic error checking, navigation window, live preview, parse tree view, profiler, goto-declaration, find usages, rename tokens, rename rules. Generates code in /gen/package/YourGrammarRecognizer.java unless you override in the configuration dialog. Shortcut to generate parsers is ctrl-shift-G / meta-shift-G but it's in Tools menu, popups. Code completion for tokens, rule names. finds tokenVocab option for code gen if there is a tokenVocab option, don't warn about implicit tokens. shortcut conflicted with grammar-kit plugin. Has live grammar interpreter for grammar preview. Right click on rule and say "Test ANTLR Rule". Changes to grammar seen in parse tree upon save of grammar. Works with Intellij 13.x and requires 12.1.x.

You can configure the ANTLR tool options per grammar file; right-click in a grammar or on a grammar element within the structured view. When you change and save a grammar, it automatically builds with ANTLR in the background according to the preferences you have set. ANTLR tool errors appear in a console you can opened by clicking on a button in the bottom tab.

You can use the meta-key while moving the mouse and it will show you token information in the preview editor box via tooltips.

Errors within the preview editor are now highlighted with tooltips and underlining just like a regular editor window. The difference is that this window's grammar is specified in your grammar file.

meta-j pops up a list of live templates, just like it does for Java programming. Currently, there are a number of lexical rules for common tokens such as comments and identifiers that you can automatically inject. There are shortcuts like rid that lets you jump directly to the lexical rule you would like to generate. If you type the shortcut and wait a second, intellij should pop up an action you can select for that shortcut.

ctrl-return, or whatever you have configured for the generate pop-up, will bring up a list of things you can generate. The only one so far is a generator to create lexical rules for any literals, referenced in the parser grammar, that have not been defined.

You can type input into an editor or select a file for testing in preview window.

Meta-key while moving the mouse shows token info per above, but now you can 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. This required a change to ANTLR 4 itself and therefore includes a prerelease version of ANTLR 4.2.3.

Alt-key while moving the mouse shows the region of input associated with parser rule that matched it. It finds parent of the token under cursor and shows region of that rule parse tree node. 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.

Added profiler tab in preview tool window. Selecting a row in the table highlights the associated decision in the grammar and highlights important regions of the input window to the left. You can sort the columns by clicking on the header row. Hover over the header row to get tooltips describing the column. If you know a lot about the internals of the parsing strategy, you can click on the expert columns to see additional information. This is the first attempt at a profiler so we can learn what is really important and then improve. If you see ambiguities highlighted, those you should definitely take a look at in your grammar. If you see decisions requiring full context sensitivity, when viewing the expert columns, those are very expensive and could be causing speed problems. Note that the profiler always tries to keep up-to-date with the input. The profiler uses the parser interpreter but is fairly consistent with the speed of a generated and compiled parser but it does use single-stage full LL parsing which can be slower. It needs to do that so that it gets full and complete profiling information. For those in the know, it uses PredictionMode.LL_EXACT_AMBIG_DETECTION.

For really big files and slow grammars, there is an appreciable delay when displaying the parse tree or profiling information.

Github source

Downloads: 27990
Rating:
Participated in rating: 2
Version Since Build Until Build File/URL Size (Kb) Date Details
1.5.1. 123.72. . Download 3263.76 2014-07-26 21:25:09 details
. .
9 updates are hidden show all updates
Screenshot #14507
Screenshot #14351
Screenshot #14519
Screenshot #14506
Screenshot #14352
Screenshot #14350
Screenshot #14512
Screenshot #14614

Recent change notes:

Separate lexers weren't working. Bug fixes.

Comments:

Anonymous
Rated:
2014-10-26 19:55:05
.
bkiers
Rated:
2014-03-22 02:14:47
Great plugin! I love the fact you can dynamically test the generated parser by typing some input source that should be parsed and immediately see the parse tree. Really cool!
.
parrt
2014-02-25 00:56:34
.