Download GTL, a Grammar Transformation Language for SDF

Transcript
Chapter 4
Implementation
4.1
Introduction
In implementing GTL a few goals were kept in mind. The maintainability and flexibility
of the implementation being the most important ones. The case study shows that for GTL
to remain usable with a changing specification of SDF the implementation needs to be
easily adaptable and extensible. This means we must use a programming language with
the features and functions that will aid the reaching of these goals.
We will start by explaining the choice of the programming language for the implementation of GTL. Then an overview of the implementation is given, after which the
implementation is discussed.
4.2
Choosing A Programming Language
The choice of a programming language for implementing an SDF transformation language
was an obvious one. The ASF+SDF meta-environment was developed for creating languages and implementing transformations on those languages, including interpreters or
compilers. This, and more, makes it a good choice for implementation of GTL.
The specification of SDF is already implemented in SDF and is provided with the
ASF+SDF distrubution, so creating a parser for SDF is not nessesary. Also, any new
version of the SDF specification will be part of a new distribution as well, meaning that
the maintainer of GTL only has to adapt the GTL implementation, not implement the
changes in the new SDF specification.
The distrubution also includes various libraries whose functions can be used in the implementation of GTL. These include functions for matching and testing character classes,
which are part of the SDF as well as the GTL language.
The modularization capabilities present in SDF also help to create a maintainable
interpreter. Modules in SDF can be parameterized, allowing the functionality expressed
in one module to be used as part of multiple sorts. Sorts, like modules, can also be parameterized, allowing for the creation of a more legible and maintainable implementation.
These SDF features are heavily relied upon in the implementation of GTL.
79