a DSL for writing rules for Xtext languages

Xsemantics 1.2.0

October 9th, 2012 | Posted by lorenzo in Uncategorized - (Comments Off)

In this new release there are some new features

Injected fields

It is now possible to define injected fields in the system; these will correspond to @Inject fields in the generated Java code. These fields will then be usable in the rules of the system

validatorExtends clause

When defining the system, one can specify the base class of the generated validator; this allows the generated abstract declarative validator to be used directly in your DSL (since it inherits all the basic settings required by a declarative validator). The idea is that you should specify as the base validator the one that Xtext generated for you in the src-gen folder.

System Extension

It is now possible to specify that a system extends another Xsemantics system (in the generated code this will correspond to class inheritance); with this feature is then possible to reuse all the judgments and rules of the base system, and also to override judgments and rules (besides specifying new rules for a judgment with more specific parameters)

When overriding a judgment, one can specify different error specifications (but the parameters types cannot be changed)

Auxiliary Functions

Besides judgments and rules, it is now possible to define auxiliary descriptions and the corresponding auxiliary functions, which can then be used in the system as standard Java methods.

Here’s an example of auxiliary descriptions

Once the auxiliary descriptions are provided you can define auxiliary functions implementations

Of course, for the same auxiliary description, multiple auxiliary functions implementations for different parameters can be provided


You can find all the details of these new features in the documentation (and in the examples).