Return to Materials

Logo example

Procedure to install and run the Logo example.

Installation of the environment

Note: it is possible to install all the required tools in your own Eclipse. However, due to possible version incompatibilities of the tools, we recommand to use the ready to use Eclipse package.

  • Get the Eclipse package containing all required tools for your system : http://gemoc.org/studio-download/
  • Unzip it somewhere on your disk,
  • Lauch the Eclipse executable.

Get the projects

All the sources of the Logo example are available on the following Github repository: https://github.com/mde-book/logo

  • In Eclipse, go to Window>Open perspective>Git,  clone the following repository https://github.com/mde-book/logo.git (If you prefer, you are free importLogoProjectsto fork the repository first).
  • In the Git repositories view, right click on the Working directory > import Projects… > Import existing projects (makes sure to check “Search for nested projects”). This will install all the project sources in the Eclipse workspace.Do not worry about the number of projects, there are several variants of the same things that have been developped for the illustrating alternative approaches in the book.
  • Switch to the xDSML or Plug-in Development perspective.
  • Makes sure everything compiles without errors. Click on Project > Clean… in order to help Eclipse rebuild all projects.

If you have a red exclamation point icon on a project, this is typically because, a source folder is missing (usually xtend-gen). In that case, simply create a folder with the expected name.

 

List of the projects

A more detailled description of the project content may be available as a readme directly in the source.

  • example.logo.interpreter : kermeta 3 project that contains the logo behavior applied on a vm model and implements a simple simulator. Uses  a simple Swing based visualization of vm models.
  • example.logo.model : metamodel that defines the Log language (+ model.edit project for editor support).
  • example.logo.ocl :static semantic of the Logo language.
  • example.logo.vm.model : metamodel of the vm, defines a “Turtle”, used by the simulator.
  • example.logo.xtext_editor : text editor and grammar for Logo. (+ xtext_editor.ui project for textual editor support).

 

Run the projects

Depending on the activity you can run and test the project directly in the first Eclipse (I.e. the language workbench). For some other activities, you need to deploy the projects in a second Eclipse (I.e. modeling workbench)

Projects with tests directly in the language workbench

The interpreter provides a main operation. To run it with the default test model, Right click on the LogoInterpeter.xtend file, then Run as > Java application.

Projects needing a modeling workbench for testing

  • The text editor  is run by deploying it in a new eclipse (typically in a runtime workbench). right click on the texteditor project, then “run as” > eclipse application.

to test the grammar, the easiest is to copy/paste the samples files present in the example.logo.interpreter/src/main/examples folder to the new Eclipse workspace. You can also create empty .logo files and use the autocompletion (ctrl+space)

Direct link to the full version of the files presented in the listings of the book

For convenience, we provide the link to the source files for listing related to Logo that have been stripped in the book.

13.1 Logo square program.
13.2 OCL constraint on the Logo metamodel.
13.3 Runtime model operations in Kermeta (excerpt).
13.4 Logo operational semantics.
13.5 Getting an Interpreter.
13.6 The Logo compilation aspect in Kermeta.
13.7 The Logo local-to-global aspect in Kermeta.
13.8 Xtext grammar definition for Logo.