XWeb

Stratego -- Strategies for Program Transformation

Introduction

XWeb is a generic template-based transformation demonstration service; it's implemented as a CGI application. The current version contains a demo for tiger (simple and advanced version) and exp-tools, but other demos can be added without to much effort.

The most recent version runs at http://stratego.insanity.nl/cgi/xweb/demo This location will change to catamaran.labs.cs.uu.nl when it has a better StrategoXT environment (catamaran is the actual Stratego server).

Resources

  • xml-tools : XML tool package, used for XML parsing and generation
  • stratego-net : Package for implementing CGI based services
  • exp-tools : Expression tool package, an incarnation of XtApplet.
  • tiger : Tiger in Stratego, currently a demo for this package been implemented
  • tiger-contract : Experimental tiger compiler package with contract support

Download and installation

The source of XWeb can be checked out using:

  svn checkout https://svn.strategoxt.org/repos/StrategoXT/trunk/experimental/xweb

There's no distribution of XWeb available.

Configuration

Configure the package:

  • --with-xt or if the packages are installed at different locations:
    • --with-aterm
    • --with-sdf
    • --with-strategoxt
  • --with-xml-tools
  • --with-stratego-net
  • --with-exp-tools
  • --with-tiger
  • --with-tiger-contract
  • --with-cgi-bin if you want XWeb to be installed in the cgi-bin of your HTTP server

Flags --with-exp-tools, --with-exp-tools and --with-tiger-contract are in some way optional. For example, if you don't want to deploy the exp-tools demo, then don't use its configure flag and remove the associated XHTML template from your webserver.

Extending xweb with new demos

The two bigger steps to undertake when extending XWeb with new demos are:

  • Add a --with-[package] construct in the configure.ac and make sure the XTC repository of the package is imported in the XWeb repository; see Makefile.am in the topdir of the package
  • Create a xhtml template in data/templates/demo directory and create a list of allowed components in the data/config directory. Example sources can be stored in data/sources/[language], see available sources' Makefile.am's for how it's done.

Creating a template

See data/templates/demo/tiger-simple.xhtml for a small example; all tags in the xhtml namespace are rendered by your browser, tags in the xweb namespace are transformed by the xweb cgi application. The application is configured using a set of properties:

  • srcdir: Directory containing programs subject to program transformation with the demo web (make sure that your HTTP server can read/write in this directory, usually this is www-data or nobody)
  • components: File containing list of allowed components that can used in compositions on the demo web (it's in fact an ATerm containing a list of Strings). In tools/ there's a little program called dir2list that scans the current directory for files without an extension (usually binaries) and creates a component list that can be used for this purpose.
  • extension: The extension of program sources. For tiger, this is .tig
  • check: Component called to check whether saving a source is allowed; usually this is a parser (like parse-tiger). XWeb checks whether the transformation of the source with this component yields an ATerm.

A number of tags in the xweb namespace are transformed by the XWeb CGI application (source can be found in src/demo.strxml); see data/templates/demo directory in the package for some nice examples.

Known Bugs (or features)

  • When source is an ATerm and has been pretty-printed by pp-aterm, it might or will not be able to transform it. Regular ATerm's work fine as source.
  • Adding available components from their selectbox isn't very intuitive.
  • When saving a source; XWeb assumes that sources are programs and checks them using the specified component (usually a parser). ATerm sources can't be saved because this checker will fail, need to fix this.

TODO

  • Allow commandline parameters after component names in the dynamic composition - done
  • Create anonymous compositions/transformations for educational purposes (guess what composition or component has been invoked) - done
  • Support multiple inputs; this enables more complex transformation demos like xml-tools and Stratego
  • Seperate service (transformations) from user-interface (XML generation)
  • Allow saving of ATerm sources

-- NielsJanssen - 23 Oct 2003