archives

XSL and DSL code refactoring

I've had lately a lot of fun and success with refactoring our DSL using XSL.

While I could have coded the refactoring in our main language (Delphi), I've tried to use a language dedicated to XML transformations and with pattern matching capabilities.

In order to do so, I've had to stream out the AST of our DSL files into XML files.
Then I've written a small IDE to select the DSL file and the XSL transformation to apply on it.
I've several tabs to display the different steps of the transformations, disable some steps, select the command line XSL engine, ...

When the transformation has been applied, the resulting AST is reloaded and the corresponding DSL code is generated.
I can then compare the source and the result to see if the transformation has changed the source file.

It's an incremental process, you can watch the corresponding XML for the DSL file being processed, compare it to the refactored one.
You then make some changes to the XSL files and restart the transformation until the resulting AST fits your needs.

Have you also had some success in this domain using XSL ?

Some references :
XSL : http://www.w3.org/TR/xslt
Java ML : java modelisation using XML