Jan 16, 2009

Stratego/XT vs. TXL (Part 1: Getting started)

Lets try to launch a simple example with both tools and evaluate the difficulty of the process, see how to deploy and where to get help.

Deployment

For TXL it is quite easy to get started since prebuild binaries are available for the variety of platforms. Download, unpack and you are ready to transform the world.

With Stratego/XT one might need to obtain a bunch of packages and compile them if needed. I didn't like the Nix system, it downloaded a lot of software and required some additional efforts to see installed software. I think the best way is to compile form sources these packages. The situation with the ability to build the whole system on a Windows platform is unclear, but there was a success-story post in a mailing-list in Nov-2008.

Documentation

Both have good documentation. But I like TXL's more. It is suitable for both learning and referencing and it is convinient to use it as a book. Also it is easy to print it and put under the pillow.

Community

Stratego/XT uses a mailing list, TXL uses a forum. I think mailing lists now can be used only for one direction communication when one needs to inform a lot of people about something. For other reasons it is impractical - not possible to categorize message, hard to search and one will get all the messages.

The number of messages in the both communities seems to be comparable and non can be considered the leader. But TXL community has one serious disadvantage. It is a solo show. There is about ten times difference between the author of TXL (No. 1 top poster) and the second top poster - 800 to 80 posts and more for others. If for some reason the author will decide to quit the project the community most probably will die. May be there is a team behind but it is not seen.

Availability

Stratego/XT tools and their sources are available under LGPL and GPL licenses.

TXL is free to use but sources are promised to be probably available on 2009 summer.

First launch

Now lets try to launch some sample. Both projects are using Tiny Imperative Language for their examples. But writing this part and evaluating tools I have found that they are using different TIL grammars. The one for TXL does not have function calls.

The task will be to parse and pretty print a simple TIL program.

TXL was much easier to lunch so I will start from it. The simple parsing and printing example required 2 files - the grammar and a program. The invokation was also simple (see the example page).

Syntax Definition and Pretty-Printing page for Stratego/XT guides to do the same. During the process I met some terms: syntax definition, parse table, abstract syntax tree, regular tree grammar, signatures, pretty-print table. To reach the final goal I invoked a lot of different tools: translators, compilers, converters, checkers (pack-sdf, sdf2table, sglri, format-check, til-parenthesize, ast2text, ppgen, sdf2parenthesize, strc, sdf2rtg, rtg2sig, pp-aterm). Once I missed one operation and at the end was wondering where the file is, but easy found the missed step. Finally I successfully got my TIL program printed out after parsing.

At the introduction stage Stratego/XT has a higher entry level because of the need to operate with much more tools and new terms to understand how it is working. TXL is much more obvious at this moment. But it may be different when one will try to do some real transformations.

IDE support

In general no dedicated IDE for both. But there are modes available for 3rd party environments (Emacs, Vim, ...).

After my recent Java to Tcl and Python transformation I would say that some project support (IDE) would be great because for the large transformation one has a large amount of rules and need somehow to browse them.

No comments: