In such a specification, abstract syntax, static
semantics and behavioural semantics are defined in a
single model-driven technical space. Unlike defining
them in different technical spaces that are hard to
check the consistency, the syntax errors and
inconsistency errors can be easily detected. The
detection of inconsistency and syntax errors become
the same problem of checking the validity of ALF
programs. By defining the grammar of ALF and
resolving the internal references, Xtext can report
syntax and inconsistency errors while editing the
ALF program.
The Xtext validator will check the errors that are
checkable in ALF domain. By using the extension
points of EMF plugin, it is possible to integrate other
types of validators. Currently the framework
supports to invoke OCL validator, other validators
are still under development.
The Xtext validator works as below: syntax
errors can appear in ALF text or OCL text. Xtext
will automatically check the errors which could be
checked by the parser. A type system is developed to
check type errors in the expressions. Separate
validator rules are defined to check well-formedness
rules, for example, an operation with a return type
must have a return statement in the entire execution
path. OCL syntax errors are checked by invoking
OCL validator in EMF. Extended static errors and
platform specific errors can be checked by the same
principle. All the static checkers require tens to
hundreds of lines of code, which are not hard to
create, but it showed that the checkers could
significantly reduce the errors in the specification.
Most logical and runtime errors are hard if not
possible to check by static analysis technologies.
However, some particular kinds of runtime errors
can be checker, for example, null pointer
dereference, impossible or redundant type cast.
4 FURTHERWORK
There are several unfinished works. There are still
some static checkers that are under research.
Conflicting errors are not directly checkable by
Xtext validation rules. One possible way to check it
is to translate the DSL spec to another analysis
domain and map the analysis result back to the users.
UMLtoCSP (Cabot et al., 2007) is a tool which can
check OCL conflicts. Currently we are working on
how to use this tool to report conflict errors. Because
this process contains translations, how to back
annotate the error message produced by the analysis
domain to the definition domain remains to be
researched.
Some Deficiency errors such as unused models
or empty stubs can be easily checked by our
framework. Currently our approach for checking
signal deficiency is a lightweight approach, which
only report error when one active class accepts some
signal, but there is no object that has sent these
signals. We wish to seek other ways that can check
more complex cases.
Currently the generation of DSL interpreter does
not support all the concepts defined in ALF standard,
it does not support direct use of OCL-like
expressions, the code still need some manual work
to test. It is interested to fully automate the
generation of an interpreter with no limitations.
The framework to use a unified definition to
define, check and test a DSL specification is only
tested by one case study. The behavioural semantics
is based on the imperative paradigm. It is necessary
to test whether the same technique can be applied to
declarative languages, because there is a large
number of DSLs which are declarative languages. It
is planned that to carry out another case study for
creating a model-based specification for a small
functional programming language.
5 CONCLUSIONS
In this paper, the correctness issue of a DSL
specification has been discussed. Seven categories of
error that can occur during the development of a
specification have been identified and introduced. It
has been demonstrated that most of these errors can
be detected using a simple static checker, making
their removal from specifications a trivial task. The
use of generating an implementation from a
specification has also been described. This has the
advantage of eliminating interpretation errors from
the process of creating DSL tooling. Finally an
extensible framework that brings together the
integration of static checks and the generation of
implementations has been outlined.
REFERENCE
Lionel Briand, Clay Williams, Pierre-Alain Muller, Franck
Fleurey, and Jean-Marc Jézéquel. Weaving
Executability into Object-Oriented Meta-languages,
volume 3713 of Lecture Notes in Computer Science,
pages 264–278. Springer Berlin / Heidelberg, 2005.
Jordi Cabot, Robert Clarisó, and Daniel Riera. Umltocsp:
a tool for the formal verification of uml/ocl models
StaticAnalysisandTestingofExecutableDSLSpecification
161