Example: Experiment with the different features of EGL using a Flowchart-to-HTML transformation.

This example uses features which are only available in the latest interim version of Epsilon.
import 'util.eol';

rule Flowchart2Index
  transform flowchart : Flowchart {
  
  template : "flowchart2index.egl"
  
  target : "../../website/index.html"
}

rule Action2Page 
  transform action : Action {

  template : "action2page.egl"

  target : "../../website/" + action.name.clean() + ".html"
}

rule Decision2Page
  transform decision : Decision {

  template : "decision2page.egl"
  
  target : "../../website/" + decision.name.clean() + ".html"  
}
[% import 'util.eol'; %]
[% out.setContentType("HTML"); %]
<html>
<head>
[%= out.startPreserve("style", true) %]
  <style type="text/css">
  </style>
[%= out.stopPreserve()%]
</head>
<body>
<h1>[%=action.name%]</h1>
<br/>

[%
  var nextSteps = action.outgoing.collect(t : Transition | t.target);
%]


[% if (not nextSteps.isEmpty()) { %]
<a href="[%=nextSteps.first().name.clean()%].html">Next step</a>
[% } else { %]
<b>finished</b>
[% } %]
</body>
</html>
[% import 'util.eol' ;%]
[% out.setContentType("HTML"); %]
<html>
<head>
[%= out.startPreserve("style", true) %]
  <style type="text/css">
  </style>
[%= out.stopPreserve()%]
</head>
<body>
<h1>[%=decision.name%]</h1>
<br/>
[% var options = decision.outgoing; %]
[% for (option in options){%]
  <a href="[%=option.target.name.clean()%].html">[%=option.name%]</a><br>
[% } %]
</body>
</html>

Check out the code from the SVN:

  • go to the SVN repository
  • navigate to trunk/examples
  • check out the org.eclipse.epsilon.examples.egl.flowchart project

Once you have checked out/imported the code, to run the example you need to go through the following steps:

  1. register any .ecore metamodels in the org.eclipse.epsilon.examples.egl.flowchart project
  2. right click the .launch file in the org.eclipse.epsilon.examples.egl.flowchart project
  3. select Run as... and click the first item in the menu that pops up

What's this?

In this example, we explore the main features of EGL by generating HTML text from an EMF model of a flowchart. We demonstrate the EGX coordination language, code formatters, preserving hand-written text with protected regions and generating a fine-grained trace model.

What are .emf files?

.emf files are Ecore metamodels expressed using the Emfatic textual syntax.

More examples...

Epsilon Object Language
Epsilon Transformation Language
Epsilon Generation Language
Epsilon Validation Language
Epsilon Merging Language
Epsilon Flock
Combining the Epsilon Languages
EuGENia
EUnit

Even more examples...

More examples are available in the examples folder of the SVN repository.