Marco van Meegen
Senior IT-Consulting - React Typescript J2EE Java Eclipse SQL ...and more


designelement missing
designelement missing
 
spacer missing
spacer missing
spacer missing
Antlr Plugin

Antlr plugin integrates the famous ANTLR Lexer/Parser-Generator into the Eclipse Software Development Environment (Websphere Studio Application Developer is the IBM-product based on the eclipse platform).

Download

Sorry, the ANTLR plugin is no longer supported. I decided to drop the antlr-plugin from my page; it's very old and I want to focus on Slime UML (http://www.mvmsoft.de/content/plugins/slime/slime.htm); on sourceforge is another antlr-plugin http://sourceforge.net/projects/antlreclipse which incorporates all features of my plugin and is more up-to-date.

Please use this one.

Goals

ANTLR is a very cool Parser generator. Well, a grammar file might get a bit confusing, if you mix comments, grammar rules, action java code. And it must be integrated well into the build process. I wanted to integrate ANTLR into Eclipse to enable easy fixing of syntax errors, browse the grammar files and integrate parser generation into the Eclipse build process.

Features
  • Syntax highlighting
  • Outline view of grammar rules
  • Builder to automatically translate grammar files to Java-files in Eclipse
  • browsing of grammars (goto rule defining token)
  • Error markers for grammar files
  • Grammar overview which parses the grammar file and shows a compressed view of the grammar, containing only terminals and non-terminals; all actions, comments, type information is removed
User Manual

Well, it's not really self-explanatory. There are some things to know to get started at all.

  • Grammar files must have the postfix .g
  • open them and you see the syntax highlighting and outline of your grammar - that's it
  • Builder support is not perfectly working yet; you need to do some things to your project to get it working.
Activating the Grammar Builder
  1. open the navigation view (package view won't work !)
  2. select your project root node
  3. open the context menu in the Navigation view on the project root node; an entry "(Un)install ANTLR Grammar Builder" should appear; otherwise check plugin version and location.

    install the builder

  4. click ok, the builder is now registered for this project and gets active, if a grammar file is inserted or changed.

    register builder message

  5. Now open the Preferences window and select Java->Builder (only for Eclipse 2.0): type *.g to exclude grammar files from being copied to the bin folder.

    configure java builder

  6. That's it. Go !
Known Limitations and Bugs
  • It doesn't work with any current ANTLR release. For the error markers I need some patches for ANTLR. The 2.7.2a2 already contains most of the patches, still hoping for a final release containing all patches.
  • This is an alpha-version. It's free for you to try, but don't use it for production purpose.
  • I have only tested it on Windows 2000. If you have any experience with other platforms, please tell me.
  • Incremental build doesn't work well with grammar files, since they are copied to the bin folder. This can only be fixed by the Eclipse 2.0 version, there you have more control over the java builder copy process.
  • From a grammar generated files are not removed anymore, if file content changes (e.g. Parser class name, removal of grammar file etc.)
  • Grammar inheritance is not supported by error markers and Parser
  • The builder always generates java-code into the same directory as the grammar; thus make sure, the grammar-directory matches the Parser-package.
Future Plans Pictures

In this picture, you see a grammar with error marker, the generated source files for the grammar file, rudimentary syntax highlighting and the outline view in action.

grammar with error markers

This is the grammar overview, which is still pretty rudimentary, but great to get an overview over the grammar without getting distracted by embedded action code.

grammar overview

designelement missing
spacer missing
©Copyright 2002-2011 Marco van Meegen All Rights Reserved
For more information feel free to Contact Me

Impressum und Disclaimer

spacer missing