/sle2019-artifact

Primary LanguageJavaEclipse Public License 2.0EPL-2.0

From DSL specification to interactive computer programming environment

Pierre Jeanjean, Benoit Combemale and Olivier Barais

Kick the tires

The kick the tires phase highlighted some issues in using this artifact. These were addressed in the answers.md file.

Development note

The main repository used to develop this artifact is currently available at https://github.com/pjeanjean/ale-repl.

Introduction

This artifact contains the necessary Eclipse plugins to generate and execute REPLs from more traditional DSL specifications.

It was made to be run on top of the GEMOC Studio, a customized Eclipse platform that includes technologies to develop, maintain and use executable modeling languages. The GEMOC Studio includes, among others, support and integration for DSL specifications, and an execution engine to execute languages with semantics written in ALE (Action Language for EMF).

The current artifact also includes the specifications of two languages that were introduced in the evaluation of the submitted paper: Logo and MiniJava.

Requirements

This artifact might also run with JDK 10, but it is not recommended as the GEMOC Studio relies on JavaFX for parts of its UI, and we find that it is not trivial to properly install it on this specific version. This artifact will not work with any JDK version greater than 10 since this specific version of the GEMOC Studio uses Xtext version 2.14, not compatible with Java 11 (see here).

Also, please note that even though this artifact should work on any platform supported by the GEMOC Studio, this was not tested extensively and, as such, we recommend to use a 64-bits Linux distribution.

We also provide a virtual machine built using the automated builder Packer that includes all these requirements, you can use it if your environment does not meet the required specifications.

Virtual Machine

You can either use the VM available here, or build your own.

The VM we provide runs Alpine Linux version 3.10.2 and already has JDK9 and GEMOC Studio 3.1.0 installed. The current version of the artifact is also included, and available at /home/packer/sle2019-artifact.

We recommend to use the shortcut Alt+F11 inside the GEMOC Studio in order to display it in full-screen, otherwise you might not see the progress bar at the bottom.

Please note that due to focus management issues, some dialogs might appear stuck (during the artifact installation for example) while they are simply out of focus and waiting for a left click.

Building the VM

If you want to build your own version of the VM, you will need to install Packer and VirtualBox (both are available on most package managers). For the sake of reproducibility, we recommend version 1.4.3 of Packer and version 6.0.10 of VirtualBox.

From within the packer folder, run the command packer build ale-repl.json.

The build should take around 30min (the longest step will be the download of the GEMOC Studio, where the output might appear stuck). Once it is finished, the image can be found in packer/output-virtualbox-iso/Ale-REPL.ova.

Running the VM

In order to run the VM, you will need to use VirtualBox.

From VirtualBox, open the File menu and select Import Appliance. Select either your generated or your downloaded Ale-REPL.ova and press Next and Import. You should then see a VM named Ale-REPL on the left side of the UI, right click on it and press Start.

The GEMOC Studio should start on its own after boot.

Instructions

Installing Xtext fix

You can skip this section if your are using a VM generated by Packer since this fix should already be installed.

This artifact generates .xtext files. However, current versions of Xtext have an ongoing issue (documented here) that prevents a proper serialization of these files. As such, it is necessary to use the fix available here. The easiest way to install it is to copy the files available in xtext-fix and paste them in the Gemoc installation directory to overwrite the plugins pre-installed in version 3.1.0 of the GEMOC Studio. If you are on OSX, the target directory should be /Applications/Eclipse.app/Contents/Eclipse.

Installing the artifact

Launch GEMOC with the required Java version, then go into the menu Help -> Install new Software.... Click on Add..., then Local... and select the update-site folder, then Add again. Untick the Group items by category option (or you will not see all the features) and select both the Action Language for EMF and Ale-Repl entries. Finally, follow the installation steps and restart the GEMOC Studio.

The update for the ALE plugin is necessary because the artifact requires at least version 1.0.0.201908141537, still unavailable on the official update site at the time of writing.

Generating a REPL

This artifact includes two of the DSLs introduced in the evaluation section of the paper: Logo and MiniJava.

Language import

To import an existing language inside the GEMOC Studio, open the File menu, then Import -> Existing Projects into Workspace. Click on Browse... and select either languages/logo or languages/minijava, then finally click on Finish.

Generate V2R

As introduced in the section Technical Details and Implementation > DSL Specification Enhancement of the paper, we defined a DSL dedicated to the specification of the metadata necessary to create a REPL from a DSL. An instance can be generated from the annotations we specified in the semantics of the two provided languages, namely @init and the multiple @repl__... annotations. You can find these semantics in either fr.inria.diverse.logo.model/model/logo.ale or org.tetrabox.minijava.lang/minijava_exec.ale. In order to generate a V2R model for these languages, you need to right click on the .dsl definition of these languages (here, they are right next to the semantics definition files and have the same name, except for the extension) and click on Generate V2R.

The generated file, available right next to the DSL file, has three distinct parts:

  • Import of the abstract syntax (used for cross references)
  • Definition of the REPL entrypoints, with optional help messages, semantics operation and expected output
  • Specification of the instruction interpreter runtime data and initialization

The obtained V2R files can be edited to better describe the expected REPL.

For more details about this part, you can refer to section 4.1 of the paper.

Generate REPL

Having a V2R file for a language, you can right click it and select the Generate REPL option. A dialogue will open, asking you to select the concrete syntax associated to this DSL. Select either Logo.xtext or MiniJava.xtext depending on the language you are currently testing.

The REPL generation might take a while, you can check it is done when the task REPL Generation disappears from the status bar on the bottom.

You should now have five new projects in your workspace:

  • languagename_repl.model
  • languagename_repl.xtext
  • languagename_repl.xtext.ide
  • languagename_repl.xtext.ui
  • languagename_repl.xtext.server

The most relevant generated files are:

  • languagename_repl.xtext/model/generated/language.ecore (abstract syntax extension, section 4.2)
  • languagename_repl.xtext/src/languagename_repl/xtext/language.xtext (textual concrete syntax extension, section 4.3)
  • languagename_repl.xtext/model/generated/language.ale (semantics extension, section 4.4)

Running a shell

In order to run a shell for a generated REPL, you first need to start a modeling workbench. To do that, go into the menu Run -> Run Configurations.... Right click on Eclipse Application on the left panel and select New Configuration. Check that the Product to Run is set to org.eclipse.gemoc.gemoc_studio.branding.gemoc_studio, and change it if it is not. Then click on Run.

In the new GEMOC Studio, use the Quick Access text box on the top-right side of the interface to find the DSL Shell component and open it.

This component is the one shown on Figure 11 of the paper.

You need to specify a port available on your machine (any will do, you can use 22222 for example) if you want autocompletion through a LSP server, then you can chose a REPL from the Languages menu.

After that, the component might take up to 10 seconds to finish loading and let you enter text at the bottom. Please note that the textbox at the bottom of the component will be disabled during the loading phase, so you should wait until you can select it before inputing commands.

Using Return key will commit the typed instruction, Tab key will autocomplete keywords, and Up and Down arrows let you circle through the commands history.

Here are some small scenarii that you could try:

With Logo_repl:

  • pendown
  • help forward
  • help right
  • to square :c repeat 4 [ forward :c right 90 ] end
  • square 100
  • 7*6

With MiniJava_repl:

  • public class ClassA { public int[] array; }
  • ClassA a
  • a = new ClassA()
  • a.array = new int[5]
  • a.array[2] = 42
  • a.array

Known issues

Builtin LFS support not present/detected

When starting the modeling workbench, the first instance of the GEMOC Studio might complain about the class org.eclipse.jgit.lfs.BuiltinLFS not being found. This is a currently known issue of the Studio, and it has nothing to do with our artifact and does not impact it, so this can be safely ignored.

Issues with CCSL engine plugin

Error messages concerning the plugin org.eclipse.gemoc.execution.concurrent.ccsljavaengine.ui might appear inside the modelling workbench. This plug-in is not used by the artifact at all, this issue is related to the GEMOC Studio and doesn't impact the process.

Language selector becomes unusable

In the modeling workbench, the DSL Shell view provides a way to select and change the used REPL though the Languages menu. It should always be possible to load a new REPL, but sometimes the UI glitches and the language selector disappears. When this happens, you don't have to restart completely the GEMOC Studio, just close the DSL Shell component and open it again.