Lambda Example Generation Tool

Steven Simpson ss at comp.lancs.ac.uk
Wed Jun 22 06:31:44 PDT 2011


[Apologies if double-posted.]

On 21/06/11 05:59, Collin Fagan wrote:
> With this talk about syntax I thought I would put together a quick tool to
> help generate lambda examples.
>
> https://sourceforge.net/projects/project-strum/files/lambda-gen.zip/download
>
> lambda-gen takes a very simple xml syntax file and combines it with a
> template to generate example lambdas.

Sounds like a job for XSLT…

<https://forge.comp.lancs.ac.uk/svn-repos/misc/gen-lambda-by-syntax/trunk/>

(It should be publicly readable.  Please excuse the self-signed
certificate.)

This includes an XML file of examples, including <lambda> elements, e.g.:

  list.sort(<lambda role="argument">

    <arg>a</arg>
    <arg>b</arg>

    <expr>a - b</expr>

  </lambda>);

Use <block> instead of <expr> if you want to enclose statements.

The various XSLT files transform <lambda>s in the examples according to
the various proposed syntaxes.  For the above, this command:

  xsltproc paren-less-strawman.xsl examples.xml

…generates:

  list.sort(#(a, b) a - b);

XSLT can test for nilary and unary cases, and this is done in
paren-less-redmond.xsl to drop parameter brackets when possible.  Note
that it retains brackets when in an argument list, by testing the @role
attribute.

Cheers!




More information about the lambda-dev mailing list