XML is dead, long live… Lisp?

So I had a go at writing a Jython equivalent of an ANT script at the weekend. I reckon it should be possible, but the syntax and structure would have to change, which I wanted to minimize (cos if I can do that its conceivable that I could parse ANT’s XML and generate Jython automatically which would be cool). It might be possible to do something with Jython’s variable argument ‘*args’ syntax, but the output could look very odd.

The issue is in the nesting. How to make

<project>
<target name="dostuff" >
<copy>
<!-- copy stuff -->
</copy>
<javac>
<!-- javac stuff -->
</javac>
</target>
</project>

look like Jython? The closest representation would probably look a bit like:

foo = project(
target("dostuff",
copy(
srcdir="src", destdir="foo"
),
javac(
srcdir="foo", destdir="bar"
)
)
)

but it would get hairy with all of ANT’s optional attributes. I’m loath to admit it, but I think the closest direct language representation would be obtained by using Lisp or Scheme. Now that I know about SISC, that might be worth a try.

Advertisements

5 thoughts on “XML is dead, long live… Lisp?

  1. Great idea! I’ve noticed the syntax anology between xml and Lisp/Scheme these days, too. Just think xml tag as Lisp’s parentheses: they all must be closed and not interlaced.

    Maybe some kind of new xml parse method can be derived from this interesting perspective.

  2. Darren,
    If you’re going to use a different syntax why not pick one of the alternative XML syntaxes like Tanga, YAML, etc. They already have parsers (often in Java) and some of them can automatically convert to and from xml.

  3. Re ant and Scheme, we’re developing a Scheme-based hybrid of ant and make. It’s not at all usable yet, kinda more in an embarrassing state =) Email if you want some details about our plans though (movable type saves the email address I input, right?)

  4. Last week, I started doing the same thing but with Ruby. In answer to ade’s question (though I can’t really speak for Darren), I’d say the reason not to do this in an alternative data representation language is that ant scripts truly have become *scripts*–not data. At least, that’s what inpsired me to give JRuby ant scripts a go. A friend and I were talking (as a lot of people seem to be lately) about how much easier it would be to write scripts in an actual scripting language.

    Ultimately, after some initial tinkering, I decided to scrap my JRuby idea. Too many dependencies. Though I could use it for my own stuff, it sure does make me mad to have to go and download a bunch of extra software just for the compilation of something (but not to support the product’s runtime).

Comments are closed.