Most code generators are either generating one kind of technology (e.g. Java) or using only one kind of models (e.g. UML). Acceleo does not restrict you to a specific domain, you want to generate code from:
Since Acceleo is based on the popular framework EMF, you can create your model with any kind of EMF based tool and use it as the input of your generation. You want to generate code from a model created with:
Now that you have your input model, what kind of technology do you want to generate? With its template based approach you can defined the kind of code generated, and you can customize it to respect your own style of coding. Do you want to generate:
Acceleo does not restrict the kind of code generated, there is only one rule:
When you want to start a code generation project with Acceleo, your first action is to create an Acceleo project. Inside of an Acceleo project, you can place Acceleo modules and the builder that comes with the Acceleo project will automatically compile the modules for you. The Acceleo project is also a container for several key preferences like the kind of serialization wanted for Acceleo modules or the severity of the error detection during the compilation.
The Acceleo perspective defines the ideal workbench to work on an Acceleo generator. It contains at its center the Acceleo editor surrounded by several views dedicated to the edition of a code generator. You can find in the Acceleo perspective the following views:
Those view will let you test manipulate the files in your Acceleo project, test Acceleo expressions, have a look at the problems and errors found in your project and use code generation design patterns.
The Acceleo tooling features a code search system that let's you find out all the references to a selected template or query.
The Acceleo editor is the center of the Acceleo tooling. It is associated with Acceleo modules (".mtl" files) and provides all the features of a modern programming editor to make you more productive when developing a code generator. As such, you can find in the Acceleo editor features like real time error detection, syntax highlighting, code completion, code navigation, a dynamic outline, etc.
The Acceleo editor also features support for "quick fixes". Thanks to the "Ctrl+1" shortcut, you can have access to solutions to basic problems in a few seconds. Those quick fixes will let you for example define a new template or a new query to replace an unknown operation that you may be trying to call in your module.
The Acceleo tooling provides several refactoring tools to help you rename or move your modules, templates and queries within your project easily.
Acceleo lets you use Java source code to compute complexe operation that may be impossible to realize using the Acceleo language. As such, you can be sure that you will be able to generate even the most complex requests.
In order to use a Java service, you need to use the Acceleo operation "invoke" in order to tell Acceleo to call your Java method and give you the result. Java services are limited to parameters and return value with the a type from one of the meta-models used in the generator or a "primitive type" (String, Integer, Real, Boolean, etc..).
Starting with Acceleo 3.2.0, you are now able to find the Interpreter view in the Acceleo tooling. Thanks to this view, you can use the Acceleo language to test and evaluate directly Acceleo expressions without having to build and run a whole code generator. This view is also extensible and as such, you can contribute your own evaluation language very easily.
The interpreter is easily exitensible to let other person contribute their own language to use to manipulate EMF based elements.
With static override, you can easily re-use the content of an existing module and change a piece of its original behavior. Dynamic override is on a whole different level as it let you change the behavior of an existing generator by defining templates that will replace existing templates of the generator. This way, like with aspect oriented programming, you can patch an existing generator built, certified and deployed on your customers computer without having to change the original generator.
Acceleo let you define protected area to give your end users specific areas where they can modify the generated code. You can initialize those protected area with a default piece of code and let your user know that they can safely modify the code protected.
Acceleo also let you use JMerge for Java files to let you precisly determined thanks to documentation tags (@generated and @generate NOT) which features should be considered as user code and thus be protected from change during the next generation.
If you wish to integrate your Acceleo generator inside of Eclipse for your customers, so that they won't have to manipulate an Acceleo project, you can use a wizard provided by Acceleo to create a basic Eclipse user interface for your generator.
You can create this user interface project with the following instructions. Right click on an Acceleo generator and select File -> New -> Project -> Acceleo Model to Text -> Acceleo UI Launcher -> Next -> Next -> Next. There you can select the name of your generator, the kind of file that should be used for the generation (*.uml for an UML generator) and where the code will be generated, by default, it will be generated in a folder named "src-gen" located at the root of the project containing the input model.
Within Eclipse, an Acceleo project automatically builds your modules but you may want to have your Acceleo generators inside of a continuous integration system. In order to do that, Acceleo provides support for stand alone maven compilation that can be plugged easily inside any maven based build.