Skip to content
  Kermeta  

Sintaks

Document Actions
Bridging concrete and abstract syntax

Download

Sintaks plugins are hosted by Kermeta, thus you can follow the Kermeta installation instruction to install Sintaks.

Note: Java 1.5 is required. Sintaks is compliant only with Eclipse 3.3.x versions or better.

Introduction

The Sintaks tool enables to define bridges between concrete (textual files) and abstract syntax (models).
A bridge consists in a Sintaks model (".sts" extension) that defines the way to:

  • parse a text in order to get the corresponding model (with respect to a given metamodel);
  • explore a model for pretty printing its textual representation.

Both functionnalities are available as entries of the KerMeta contextual menu:

  • on ".txt" files for the Model2Text transformation;
  • on ".xmi" files for the Text2Model transformation.

Additionnaly, Sintaks allows to generate automatically textual editors for a model providing  syntax highlighting.

Sintaks is based onto the EMF repository. Packages of the handled metamodels therefore have to be registered here before running any Sintaks transformation.

Registering action is provided either by the extension point named "org.eclipse.emf.ecore.generated_package" or thanks to the registering action provided by Kermeta.


In development (ie. in the CVS) a plugin allows to automatically generate an HUTN grammar for any ecore metamodel.

Documentation

Publications

  • Pierre-Alain Muller, Franck Fleurey, Frédéric Fondement, Michel Hassenforder, Rémi Schneckenburger, Sébastien Gérard, and Jean-Marc Jézéquel. -- Model-driven analysis and synthesis of concrete syntax. -- In Proceedings of the MoDELS/UML 2006, Genova, Italy, October 2006. [PDF][BibTeX]
  • Pierre-Alain Muller and Michel Hassenforder. -- Hutn as a bridge between modelware and grammarware. -- In WISME Workshop, MODELS / UML'2005, Montego Bay, Jamaica, October 2005. [BibTeX]

Getting Sintaks samples

In Eclipse, click on New > Example > Sintaks samples > Sintaks samples, then a project will be created with all needed files.

Creating a new Sts model

The simplest way to create a new Sts model is to use the generated Sts wizard. For this purpose:

  1. go to the menu "File > New > Other... > Example EMF Model Creation Wizards";
  2. select the entry "Sts Model" and go to "Next";
  3. select the name of your Sts model and go to "Next";
  4. select the "Root" element as the "Model Object" and "Finish".

At this stage, you can add an initial Template to the created Root element, but it is still impossible to attach a metaclass to this Template.
To this end, it is necessary to include the abstract syntax information (ie the metamodel) into the Sts model.
This can be achieved using the "Load Resource..." option, available by right-clicking onto the Sts editor view.
This facility allows you to browse the Workspace and the file system for choosing a metamodel file.
The problem is here that it is necessary, for the Sintaks prototype to work, to provide a package URI that had been previously registered among the EMF repository (instead of a file path).

At this stage, there are two possibilities:

  1. Use the "Load Resource..." facility, select your metamodel file ("MyMM.ecore") and edit your Sts model. Once the model is edited, open it with the textual editor and replace all instances of "MyMM.ecore" by the corresponding registered URI of a package/subpackage of the metamodel (for instance "http://MyMM"). Your Sts model can now be used to bridge concrete and abstract syntax.
  2. Create a temporary subrule (such as a Terminal) for your Template element (this temporary element should be removed once the manipulation is completed). Save your model and re-open it with the textual editor. Your file should be 6 lines long. Add the following line as the 4th line (after the Template rule line):
    <metaclass href="MyMM#//aMMElement"/>
    where MyMM is the registered URI of the root package of your metamodel and aMMElement is a class of this package.
    Save the file and re-open it with the Sts editor. You can now finish the Sts model edition (further links to the metamodel elements will be directly encoded wth the packages URI) and use it to bridge concrete and abstract syntax.

Run a Model2Text or Text2Model transformation

After finishing your sts file, you can now try to convert a text file into a model. In order to do so, you should:

  1. Create a text file following the defined syntax
  2. Right click on it and choose: Kermeta -> Text to Model
  3. Choose your .sts file as the syntactic model and click finish
  4. A XMI model representing your input file in abstract syntax is then created

If the XMI file isn't as expected, it can be due to a bad specification of the sts file or because the input file doesn't obey the rules defined by the sts.

Additional resources

  • GForge project dedicated to Sintaks: http://gforge.inria.fr/projects/sintaks/ (user mailing list, bug report, feature request)
  • Contributing to Sintaks: getting the Sintaks and Kermeta projects from the CVS

You can easily obtain the Sintaks + Kermeta source code in your workspace using a Team Project Set File. You can get the one available *.psf file to quickly set up a workspace with the Kermeta projects fetched from CVS that you'll need to get started:

sintaks.psf (anonymous users)

If your web browser save these files with a *.html, *.htm, *.xml extension, you should replace it by hand by *.psf.

From File > Import/Export... simply select 'Team Project Set' from the Import list, navigate to the file, and you're done. You might need to use "anonymous" as user name (no password is required) during the checking out of the plugins.