Tom 2.6

Tom is a software environment for defining transformations in Java.
Tom is a software environment for defining transformations in Java.

Tom is a pattern matching compiler developed at INRIA. It is particularly well-suited for programming various transformations on trees/terms and XML based documents. Its design follows our research on rule based languages, and our experiences on the efficient compilation of ELAN developed by the Protheo group.

Here are some key features of "Tom":

· Tom is an extension of Java designed to manipulate tree structures and XML documents.
· Tom is compatible with Java: any Java program is a correct Tom program.
· Data are represented using an efficient object oriented tree based data-structure.
· Java builtins (int, char, String, etc) can be used.
· Tom provides pattern matching facilities to inspect objects and retrieve values.
· A powerful strategy language can be used to control transformations.
· Tom is used in several companies to implement transformations of programs and queries.

Is there any implementation?

Tom is a tool implemented in Tom itself. When observing its illuminated face, Tom can be seen as a Yacc-like compiler translating patterns into executable pattern matching automata. Similarly to Yacc, when a match is found, the corresponding semantic action (a sequence of instructions written in Java, C or Caml) is triggered and executed.

When observing its dark side, Tom is a complex compiler which adds non-trivial constructs to Java, C and Caml(ML family), and offers the possibility to analyse any kind of data-structure. Tom is a real programming language, with many programming and debugging facilities.

What is it good for ?

Tom is good for:

· programming by pattern matching
· transforming XML documents
· implementing rule based systems
· describing algebraic transformations
· improving the quality of your software

Tom is language extension which adds a new matching primitives to C and Java: %match. This construct is similar to the match primitive found in functional languages: given a term (called subject) and a list of pairs: pattern-action, the match primitive selects a pattern that matches the subject and performs the associated action. This construct may thus be seen as an extension of the classical switch/case construct. The main difference is that the discrimination occurs on a term and not on atomic values like characters or integers: the patterns are used to discriminate and retrieve information from an algebraic data structure. Therefore, Tom is a good language for programming by pattern matching.

In its first version, the syntax for describing patterns was restricted to prefix term notation. Recently, this syntax has been extended to XML syntax. By combining this natural syntax with powerful associative-matching capabilities, Tom appears to be a serious alternative to manipulate XML documents in Java. The interest of this approach is to combine a well established programming environment (Java) with an expressive, and theoretically based pattern matching language.

In addition to %match, Tom provides a %rule construct which allows to describe rewrite rule systems. This construct supports conditional rewrite rules as well as rules with matching conditions (as in ELAN or ASF+SDF). By default, Tom provides a left-most innermost normalization strategy which allows to compute normal forms in an efficient way. It is of course possible to combine these features with more complex strategies, like generic traversal strategies, to describe more complex or generic transformations. When understanding all the possibilities offered by Tom, this general purpose system becomes as powerful and expressive as many specific rewrite rule based programming languages.

last updated on:
May 9th, 2008, 19:32 GMT
developed by:
Tom Team
license type:
GPL (GNU General Public License) 
ROOT \ Programming \ Debuggers


In a hurry? Add it to your Download Basket!

user rating 16



2 Screenshots

Add your review!