Developing a Language with Freon
Developing a Language with Freon is usually done taking the following steps.
- Develop the metamodel.
- Add the concrete syntax by adding an editor definition.
- Add scoping, typing and validation information (see Freon Definition level).
- Fine-tune the result on the API level.
If you are working with Webstorm, you might consider installing the plugin Awesome Console. This plugin redirects a click on an error message in the console to the correct position in any of the language definition files.
The Example
In this section we will be using the Insurance language as example. The gist of the Insurance language is
that it defines two types of units. One unit holds set of parts of insurance products for a single theme,
like ‘Home’, or ‘Health’. This set is called a BaseProduct
. The second contains a complete insurance
product that consists of a number of insurance parts from one or more BaseProducts
. This is called an
InsuranceProduct
.
An InsuranceProduct
has an expression called calculation
that describes the expected cost of this product.
To simplify this expression helpers function may be defined. Each of these is called a CalcFunction
.
The following figure shows a UML class diagram of the concepts in the language.
We are working on a few other examples. You can find them in the samples
folder in the
development branch of Freon.