I did this recently: I had a need for an XML-based scripting
language, and an old scheme interpreter I wrote in Java. I
wrote a new Reader class (hey I wrote it befire Reader was in
java.io.*), and voila! The encoding wasn't pure scheme though...
I would probably encode lisp using cdr-coding.
---------------------------------
<!--
XMLScript is an expression language encoded using XML. It is
essentially the same as a scheme subset. The transformation
is roughly:
<add> (add
<const>1</const> 1
<var>a</var> a
</add> )
or in other words, the start and end tags are turned into a
procedure call *except* for the special cases of <const>
and <var> which are simply stripped and passed as atoms
and symbols to the procedure. These do not need to be marked
up explicitly.
Note: This is actually a little white lie... what really
happens in the implementation is simple string
substitution, so the PCDATA content of an argument
list is parsed as per the normal parsing rules of
scheme.
-->
<xmlscript>
<!-- Simple test -->
<write><sub>10 2 1</sub></write>
<newline></newline>
<!-- Test lambda and define -->
<define>test
<lambda><args>a b</args>
<add> a b </add>
</lambda>
</define>
<define>a 1</define>
<define>b 2</define>
<define>c 3</define>
<write>
<add>1 2 3 4 <const>5</const> <test>20 20</test></add>
</write>
<newline></newline>
<!-- Test getprop and setprop -->
<getprop>foo</getprop>
<setprop>foo <const>"bar"</const></setprop>
<!-- Test if -->
<if>
<gt>b a</gt>
<getprop>yes</getprop>
</if>
<!-- Test cond -->
<cond>
<args><gt>a b</gt> <write>"yes"</write></args>
<args><gt>b a</gt> <write>"no"</write></args>
</cond>
<newline></newline>
</xmlscript>