DSL Editor

DSL Editor is an Eclipse editor foundational framework that enables rapid development of custom syntax-directed editors for the Eclipse platform.


Advantages

  1. Rapid generation of full, custom Eclipse syntax-directed editors.
  2. Easily adapted and extended for production use.
  3. Supports any language that can be described by an Antlr4 grammar.

Architecture

DSL Editor is broadly similar in purpose to the frameworks provided by the DLTK and XText projects. Each supports the production of custom editors for Eclipse.

The implementing architectures are, however, entirely different.

  • DLTK requires the DSL language to be deeply embedded in, and tightly integrated into the core of the framework.
  • XText requires the DSL language to be implemented in a limited, proprietary language.

In contrast, DSL Editor provides integral Core and UI bundles that act as libraries to thin custom editor Core and UI bundles to provide editor specialization.

The custom Core is responsible for generating parse-trees utilizing the DSL language grammar. The DSL Editor Core internal model is effectively the Antlr4 parse-tree model, allowing it to accept and efficiently work with any standard Antlr4 generated parse-tree. Detailed characterization of the parse-tree is performed using XVisitor-generated visitors that feed the operation of, for example, the Outline view, the code formatter, and the code-completion processors.

The custom UI is largely responsible for providing the preferences user interface. Where applicable, the custom UI is also responsible for providing a builder executor. Specialization of the editing experience is handled largely through parameters specified in the implementation of the custom UI code. Where existing DSL Editor behaviors are insufficient or inappropriate, funtional overrides can be readily included in the custom UI.

In all, the custom editor code is quite thin, and largely characterized as providing parameters for the specialization of the DSL Editor instance and dedicated components that are are only strategically coupled to the implementation of the DSL Editor itself.

Every customized DSL editor looks, acts, and operates as a completely standard, fully custom Eclipse plugin editor.


Features

  • Allows unrestricted use of all Antlr 4 grammar features
  • Full automatic editor problem marker support
    • real-time feedback generated directly from parse-tree generation
  • Built-in foundational support for code formatting using XVisitor grammars
    • specific behavior is managed using standard preference page-based controls
  • Syntax highlighting, smart editor, and other standard Eclipse editor features
  • Standard code template support
  • Occurrence marker support - heuristics are driven by XVisitor grammars
  • Code completion support - heuristics are driven by XVisitor grammars
  • Outline page - text and label display is driven by XVisitor grammars
  • Incremental and full builder support
  • Does not define an ‘own’ project type - multiple DSL Editors-based editors can be used independently as secondary editors within any primary project
  • Delivered as a small set of plugins - installed and updated using the P2 update manager

Use

To build a custom language editor, the developer writes

  • a standard ANTLR 4 grammar to represent the structure of the language
  • a set of XVisitor grammars to support the outline view, formatting, code completion, etc.
  • a set of standard preference pages qualify the editor, formatting, and building behaviors.

The result is a complete custom language editor plugin, with all of the standard editor features including outline, builder, formatting, code assist, and templates.


Examples

Editors built using DSL Editor include:

AntlrDT Antlr grammar editor and builder
XVisitorDT XVisitor grammar editor and builder
StringTemplateDT StringTemplate 'st' and 'stg' file editor
TomlDT TOML structured resource specification editor
ProtoBufDT Google Protocol Buffers definition file editor

Development State

In active development. Current version is 0.5.5.

TBI features

  • Context-sensitive code completion

Requirements

  • Eclipse 4.5.2 on Java 8 VM

License

Eclipse Public License v1.0