ALE

Action Language for EMF

First steps

Requirements

Objectives

Get the HelloWorld example

ALE provides an Hello world! project template:

  1. File > New > Example...
  2. EcoreTools ALE Examples > Hello world!
  3. Select helloworld
  4. 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.

What we have inside

The interesting files of the helloworld project are inside the folder model:

File Defines
HelloWorld.aird Graphical representation of HelloWorld.ecore
HelloWorld.ale Semantics of HelloWorld.ecore
HelloWorld.dsl Binding between the metamodel (HelloWolrd.ecore) and its semantics (HelloWorld.ale)
HelloWorld.ecore Metamodel describing the EClass HelloWorld
HelloWorld.xmi Instance of the EClass HelloWorld

By opening HelloWorld.aird you will see the HelloWorld EClass and its properties:

HelloWorld EClass

As you can see, all the members of HelloWorld are displayed in a bold font. That indicates that they are defined inside HelloWorld.ale.

Note: if the members are not shown make sure that the Behavior layer is activated.

HelloWorld.ale contains the following code:

behavior HelloWorld;

open class HelloWorld {             // 1

    String msg := 'Hello world!';   // 2

    override EString greeting() {   // 3
        result := self.msg;         // 4
    }

    @main                           // 5
    def void entryPoint() {
        self.greeting().log();      // 6
    }
}

Tip: see the Reference page for a detailed overview of ALE’s syntax.

Run!

The execution can be launched through the contextual menu:

  1. Right-click on HelloWorld.dsl
  2. Select Run As > ALE launch, a dialog should open asking you to select the model to interpret
  3. Make sure HelloWorld.xmi is selected then click on OK.
  4. Witness the result on the console:
Run helloworld.dsl
------------
Hello world!

Conclusion

Now that we covered the basics of ALE you’re ready to go further with the MiniFsm tutorial.