4. The Eclipse plug-in
The aim behind developing a desktop IDE for GF is to provide more powerful tools than may be possible and/or practical in a web-based setting. In particular, the ability to resolve cross-references between source files and libraries instantaneously during development time is one of the primary goals and motivations for the project.
The choice was made to develop this desktop IDE as a plugin for the Eclipse Platform as it seemed to be the most popular choice among the GF developer community. Support for the platform is vast and many tools for adapting Eclipse to domain-specific languages already exist. Unlike the zero-click WIDE approach, using the GF Eclipse plugin (GFEP) will require some manual installation and configuration on the development machine. Thus the GFEP is aimed more at seasoned developers rather than just the curious.
4.1. Features
Implemented (including partially)
- Syntax highlighting and error detection
- Code folding, quick block-commenting, automatic code formatting
- Definition outlining, jump to declaration, find usage
- Warnings for problems in module dependancy hierarchy
- Launch configurations, i.e. compilation directly from IDE
Coming soon
- Auto-completion for declared identifiers
- Inline documentation for function calls, overloads
- Quick-fix suggestions for syntax and naming errors
- Code generation for concrete/instance modules
- Code generation for new languages in application grammars
- Grouping of concrete syntaxes by language, fast switching and linked navigation
- Built-in library browser (in particular for GF resource grammar library)
Long-term goals
- Test-suite functionality
- Treebank management and testing
- Possibility to incorporate treebank tool demonstrated by Jordi Saludes in the Math Grammar Library
- Provide a single platform for developing and using embedded grammars
- Integration with ontology engineering tools
4.2. Status
The starting point for the GFEP is using the Xtext DSL Framework for Eclipse
(http://www.eclipse.org/Xtext/). By converting the GF grammar into the appropriate Extended-BNF form required
by the LL(*) ANTLR parser, the framework provides a good starting point for future plugin development, already
including a variery of syntax checking tools and some cross-reference resolution support. The specific requirements
of the GF language, particularly in the way of its special module hierarchy, mean that significant customisations to
this generated base plugin are needed.
As of 1st October 2011, a first prototype of the GFEP has been released to GF developers to gather some initial
feedback. This first release is not intended to be a mature development tool, but a showcase of some of the potential
features that can be provided by developing GF grammars within a powerful desktop IDE. Reactions from within the GF
developer community will guide the way forward, both in prioritizing the future tasks and also in better guaging the
person-month cost that an eventual mature version of the plugin would require.
4.3. Trying out the GFEP prototype
Installation
- Eclipse is of course required. The plugin was developed using Eclipse 3.7 but older versions should also work.
- Inside Eclipse, go to Help > Install New Software.
- Add new software site using the URL: http://www.grammaticalframework.org/eclipse/beta/.
- Select the GF Eclipse Plugin, click Next, accept the license agreement and install. If it takes a long time to calculate
dependencies, just be patient. I'm not yet sure if this is an abnormal issue or not.
- Accept the prompt warning that the software is unsigned.
- Restart Eclipse when prompted.
- (Optional) Add the GF perspective clicking Open Perspective > Other.
- (Optional) Go to Run > Run Configurations and add a new Grammatical Framework configuration. Fill in the
necessary fields in the Main tab, and click Apply to save the new configuration.
Getting started
- Create a new blank General project in the usual way. If asked whether you want to add the Xtext nature to your project, you can safely say no.
- There is a wizard for adding a new GF source file from File > New > Other > GF Source File:
- You can find a small example at http://www.grammaticalframework.org/eclipse/examples/hello/. Download the
files and manually add them to your Eclipse workspace.
- Note how changing a
cat
definition for example will produce warnings and/or errors in other the modules.
- Compile your source using the provided Run Configuration.
Known issues
- Local parameter/binding identifiers show up as unresolved, e.g.
recip
in:
Hello recip = {s = "hello" ++ recip.s ! Masc} ;
- Qualified names currently aren't treated correctly, so
Masc
works but ResEng.Masc
does not.
- If the Apply button in the Run Configurations dialog doesn't remains disabled, swap to the Common tab and back.
- Selective inheritance has not been properly tested.
- Interfaces/functors are currently not supported.
- The in-editor validation often needs to be triggered by some keystrokes, especially when Eclipse laods
with some already-opened files.