The DSL Forge is now open-source!

First of all, happy new year! I’m writing this post to give some fresh news about the current state of DSL Forge.

Getting the tool to its current state wasn’t an easy task. At the time I was working for itemis, the prototype attracted customers attention, as it was a precursor in the area of domain-specific language web editors. Things were going in the right direction, however, for political reasons, the Xtext team at that time wanted to provide a new tool built from scratch.

That sounds weird right? Anyway, that was the reason why I left the company in July 2015 and started PlugBee, a software company specialized in Model-Driven Engineering. DSL Forge has evolved since the original prototype released in January 2014, the tool is now  open sourced under the EPL licence. You can download it from here, you will also find initial documentation to get started. The code is also available on GitHub.

A reminder of what’s the tool for:

The DSL Forge Framework

 

dslforgeDSL Forge framework allows you to get web-based textual editors from ANTLR grammars. From the grammar specification, a JavaScript parser and lexer are automatically generated and embedded into Cloud9’s ACE editor.

How it Works

The core of the generator is a model to text transformation between Xtext and ANTLR. Indeed, the Xtext grammar specification language uses a subset of ANTLR, it also adds extra sugar to make parsing EMF models more accurate. The generator extracts the core ANTLR spec from the Xtext spec and outputs an ANTLR grammar file. From the ANTLR file, JavaScript parser and lexer are instantly generated. This way, the client parser can be used to mirror the Xtext parser on the client side. It’s up to the developer to customize the way the parsers are used, the editors can be adapted for this purpose.

Why ACE

ACE is one of the most robust JavaScript editors, it has a clean JavaScript API, it comes with a lot of features already bound by default. The fact is, Cloud9 has specialized the editor for dozens of languages such as (JavaScript, Phyton, etc) but there isn’t any methodology nor tool to specialize ACE for custom languages. Thanks to our experience in model-driven engineering, we were able to automatize such a task, making it possible to get the editor just from the grammar specification.

To Backend or Not to Backend

It doesn’t matter in fact, both scenarios are handled by the tool. The tool is able to generate a static web project containing the ACE editor already customized for the language. This is a HTML/JavaScript project which runs entirely on the client side. Moreover, it can generate a JEE application based on Eclipse RAP with an Xtext backend. In the last scenario, the developer is free to customize where the features are handled. More info about the use cases in the online documentation.

Getting Hands on Codenvy and Eclipse Che, a Quick Feedback

Let’s have a very quick tour inside Eclipse Che which is the open-sourced Codenvy cloud IDE available under the umbrella of Eclipse Cloud Development (ECD). Well, the stuff is promising as it offers a platform for developing Cloud IDEs based on services, and comes with a methodology to build extensions – like we do in Eclipse RCP – but fully on the web.

After watching the videos on the official website here,  I started with the instructions on GitHub and built the Codenvy app with Maven. First potential pitfall: make sure you don’t have both Maven command line tool and the embedded Maven plugin in your Eclipse IDE. You may experience compilation problems, in that case, it’s not a bad idea to purge your .m2 folder.

All right, after five minutes, you got the beast built and ready to use (you may be asked to move to JDK 1.8 when compiling GWT). Let’s have a look into the checkouted git repo and see what actually happened.

Like Oh my God! You have a dedicated Tomcat IDE lying on your file system! The corollary of this: if you have already a Tomcat running on your machine, expect having troubles when running the startup script.

Once all the services running on port 80 have been stopped (by default Che runs on localhost:8080), let’s move to the next step. Under Windows, open a command prompt, navigate to the root of the repository then type che.bat start. Once the webapp starts, you are prompted to select a workspace location in your file system.

Now let’s see what’s already packaged with the default application, and start by creating a project… The good news is: the catalog of technologies already available is quite large. You can create projects targeting GWT, JSP, Spring, and a lot of other stuff I’ve never experienced before (well I’m not a reference)… Let’s create a Maven project then!

The project is created, you can check your file system, it’s already there. Then, create a Java class. The editor is opened and here we are! Let’s enter some code… And what a surprise! No syntax validation, no content assist… I’ve missed something or what?

Okay, let’s see what’s happening under the hood: open the JavaScript Console (if you are using Chrome), and guess what ? Already 24 errors out there….

Hmmm, let’s try to change the editor, go to Preferences > IDE Settings > Editors and change from Orion to CodeMirror (by the way, there is no other theme than the shitty black theme, I don’t know why most cloud IDEs are black by default…). Have a look to the sources, both editors source code are already available on the client side… Changing the editor does not fix the problems… Come on guys!!

I like the idea behind Eclipse Che, as it offers a methodology fully based on the web, i.e. a cloud IDE for developing cloud IDEs (of course, if you dislike the recursion, you can still develop cloud IDEs from an Eclipse IDE, ndlr Eclipse RAP) but it seems like it’s still in its early phase… I’m curious to see how fast it’s going to be adopted by developers. Let’s wait and see…