Certiv Analytics

Certiv Analytics

Innovative Legal Analysis Tools

DSL Editor

Dsl Editor is a language editor development framework for project indifferent domain specific languages (DSLs). Standard, full-function Eclipse editors can be built using DSL Editor.

Optimal for creating custom DSL editors with code-generation builders. Editors built using DSL Editor include

  1. AntlrDT: an editor for Antlr grammars
  2. StringTemplate: an editor for StringTemplate specifications
  3. ProtoBuf: an editor for Google Protocol Buffers definition files
  4. SpecDsl: an editor for CSS-like structured resource specifications

Architecture

Conceptually, DSL Editor fits between DLTK and XText.

Like DLTK, custom DSL Editor-based editors are constructed by extending a few key classes. Like XText, the editor is functionally defined by an Antlr grammar.

Unlike DLTK, DSL Editor imposes no fixed language model, does not define or require an "own" project type, and imposes no internal model hierarchy. By design, multiple different custom editors based on the DSL Editor can freely co-exist within a single project without negative interaction.

Unlike XText, custom DSL Editor-based editors are constructed directly using native Antlr grammars. Custom and heterogeneous AST nodes are allowed. No constraints are placed on using Antlr predicate, action, and rewrite features. Formatting behavior is not hard-coded. Formatting preference pages are JDT-like, providing full profile and preview support.

Features

  1. the native editor model is an Antlr AST - user defined - no significant design restrictions - all Antlr grammar features can be used in the construction of the AST, including predicates, tree rewrites, etc.
  2. full support for editor problem markers - real-time feedback generated directly from the AST
  3. code formatting - DSL specific using a tree pattern matcher - behavior is managed using preference page-based controls with preview and profiles support
  4. syntax highlighting, smart editor, and other standard Eclipse editor features
  5. standard code template support
  6. occurrence marker support - heuristics are driven by a tree pattern matcher
  7. code completion support - heuristics are driven by a tree pattern matcher
  8. outline page - text and label display is driven by a tree pattern matcher with the full content of the AST available for use
  9. incremental and full builder support
  10. does not define a project type - multiple DSL Editors-based editors can be used independently as secondary editors within a single primary project
  11. delivered as a small set of plugins - can be updated using the update manager

Advantages

Create Eclipse editors for any language, including non-LL(k) DSLs. If the language can be described by an Antlr grammar, an Eclipse editor can be constructed using DSL Editor.

Because DSL Editor directly uses the Antlr AST as the internal model, the complexity of building an editor using DSL Editor is largely independent of the complexity of the language.

Development State

In active development.

Looking for sponsors to support continuing development. Will consider transition to an open source license under appropriate circumstances.

Use

To build a custom language editor, the developer writes

  1. a standard ANTLR grammar to represent the structure of the language
  2. a few tree pattern matchers for outline, formatting, etc., and
  3. extend a few base editor and preference page classes to connect the parts

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