Compiler for ALE Language
ALE provides an Hello world!
project template:
File > New > Example...
EcoreTools ALE Examples > Hello world!
helloworld
Finish
After a few seconds a new project called helloworld should be created in your workspace. This project defines a simple HelloWorld
EClass able to print “Hello world!”. The content of the project is presented below.
For more details of the language’s architecture, see ALE first steps.
At this point you are able to interpret Helloworld programs using the ALE interpreter.
src/helloworld.dsl
in this project, with the following content:syntax=platform:/resource/helloworld/model/helloworld.ecore
behavior=platform:/resource/helloworld/model/helloworld.ale
compilationType=interpreter
helloworld.ecore
META-INF/MANIFEST.MF
, and on the Dependencies list, add org.eclipse.emf.ecore
, helloworld
, and org.eclipse.emf.ecoretools.ale.compiler.lib
on the project’s required plugins.interpreter-comp
directory and select **Build Path > Use as Source FolderYou have generated a compiled version of the helloworld language following the Interpreter implementation pattern.
By substituting interpreter
by visitor
, switch
or revisitor
in the steps above, you can freely compile your language to another implementation pattern.
Prerequisite: We do not cover the details of the integration of you project using maven but several example of ALE language with a maven integration can be found in the ale compiler github repository.
Once your language integrated with maven, the automated compilation using the alecompiler-maven-plugin can be integrated by adding the following definition in your language’s pom.xml:
<build>
<sourceDirectory>PATTERN-comp</sourceDirectory>
<plugins>
<plugin>
<groupId>org.eclipse.emf.ecoretools.ale.compiler</groupId>
<artifactId>alecompiler-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>ale-dsl-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<dslFile>${project.basedir}/src/LANGUAGE.dsl</dslFile>
</configuration>
</plugin>
</plugins>
</build>