Lambda Example Generation Tool
Collin Fagan
collin.fagan at gmail.com
Mon Jun 20 21:59:49 PDT 2011
Hi Everybody,
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. The README file explains more but
here is the gist.
Syntax
<?xml version="1.0" encoding="ISO-8859-1"?>
<syntax name="Strawman with Colon">
<prefix>:</prefix>
<startParamList>(</startParamList>
<endParamList>)</endParamList>
<startBlock>{</startBlock>
<endBlock>}</endBlock>
</syntax>
+
Template
/*
* Syntax Poll Example:
*/
list.filter(<syntax.prefix><syntax.startParamList>Foo
t<syntax.endParamList><syntax.startBlock>t.length() \> 3<syntax.endBlock>)
.map(<syntax.prefix><syntax.startParamList>Foo
t<syntax.endParamList><syntax.startBlock>t.barCount<syntax.endBlock>)
.max();
=
Example:
/*
* Syntax Poll Example:
*/
list.filter(:(Foo t){t.length() > 3})
.map(:(Foo t){t.barCount})
.max();
I've put together a number of different syntax files for the strawman, BGGA
and others. That said, it is a simple tool meant for experimentation and
syntax comparison only.
I have a few examples already in the template. I would be happy to add more
if people think they have a good use case.
Enjoy,
Collin
More information about the lambda-dev
mailing list