## Section: New Results

### Integration of formal methods in programming languages

#### Formal islands and Tom

Participants : Emilie Balland, Paul Brauner, Horatiu Cirstea, Yves Guiraud, Pierre-Etienne Moreau, Claudia Tavares.

In [1] we have proposed a framework which makes
possible the integration of formally defined constructs into an existing
language.
The *Tom* system is an instance of this principle: terms, first-order
signatures, rewrite rules, strategies and matching constructs are integrated
into Java and C for instance.
The high level programming features provided by this approach are presented
in [64] .
The *Tom* system is documented in [28] .
A general overview of the research problem raised by this approach are
presented in [63] .

One interest of *Tom* is to make the compilation process independent of the
considered data-structure. Given any existing data-structure, using a
*formal anchor* definition, it becomes possible to match and to apply
transformation rules on the considered data-structures.
During the internship of Nicolas Henry, we have developed a mapping to connect
data-strucre generated by the Eclipse Modeling Framework to the *Tom*
framework. The long-term goal of this project is to provide constructs to
describe transformations of models, ion an expressive and safe way.

*Tom* is also a natural choice for querying and transforming
structured data and in particular XML
documents. In [23] we presented an
extension of *Tom* that makes available all the *Tom* features into
a syntax adapted to XML document manipulation. This extension can be
in fact easily adapted to accommodate any other structured data
provided that a tree representation can be obtained out of it.

We are currently working on the definition of a new type system for *Tom*
along with the associated type inference and checking
algorithms [27] .
This type system allows to declare polymorphic first-order signatures along
subtyping and (in)equations, which will eventually extend the expressivity
of the *Tom* language by allowing the encoding of BNF grammar.
Moreover, it provides a strictly defined semantics to *Tom* 's “star variables”
which modelize matched sublists of associative functions symbols.

#### Extension of pattern-matching

Participants : Emilie Balland, Horatiu Cirstea, Claude Kirchner, Pierre-Etienne Moreau.

Graphs are omnipresent in program analysis. The implementation of
static analysers require the representation of control-flow and
data-flow graphs for instance. As *Tom* can only manipulate tree
structures, we proposed an extension to deal with graph structures as
shown
in [10]
and [38] , [37] . The
main idea is to use paths to represent cycles and shared parts. This
leads to an original and clean way for representing, matching and
transforming graphs in a rewrite-based environment.

Negation is intrinsic to human thinking and most of the time when searching for something, we base our patterns on both positive and negative conditions. In [14] we present the notion of anti-terms, i.e. terms that may contain complement symbols. We present algorithms for solving anti-pattern matching problems in the syntactic case as well as modulo an arbitrary equational theory E, and we study the specific and practically very useful case of associativity, possibly with a unity (AU). To this end, based on the syntacticness of associativity, we present a rule-based associative matching algorithm, and we extend it to AU. This algorithm is then used to solve AU antipattern matching problems. AU anti-patterns are implemented in the Tom language and we show some examples of their usage.