Papyrus has already have code generation support for C++ and Java programming languages. Besides, support for Ada and C programming languages are also on the way. However, it is possible to develop and integrate new code generators for other programming languages to Papyrus. In this article you will find how add a new code generator to Papyrus from scratch.

Preparing the Development Environment (Prerequisites)

This section provides a step-by-step guide to set up your development environment in order to be able to add a new code generator for Papyrus.

Assuming that you have already installed Papyrus, here are the steps you need to follow:

Preparing the Required Projects

To be able to develop a new code generator for a programming language (let's say the X programming language), you need to create three different (but interrelated) projects.

Now, let's create and prepare all these projects one by one.

The Main Code Generation Project for the Hypothetical X Programming Language

Here are the steps for creating and setting the org.eclipse.papyrus.x.codegen project:

The User Interface Project

Here are the steps for creating and setting the org.eclipse.papyrus.x.codegen.ui project:

If all the steps worked fine, you can go on by creating the test project of your code generator.

The Test Project

Here are the steps for creating and setting the "org.eclipse.papyrus.x.codegen.tests" project:

Developing the New Code Generator

To develop a new code generator, you will use the Xtend language. For starting Xtend, see the Xtend introductory video and the Xtend documentation.

Basic Configuration

Here are the basic configuration steps for developing the example code generator:

Advanced Options

Generating the Code in a New Project

Dealing with Errors

Integrating the New Code Generator to Papyrus/Qompass

The ultimate goal of developing a new code generator is to make it available to all users. If you want to integrate your new code generator into Papyrus/Qompass, just contact with us.