Re: s-expressions and XML was Re: terra incognita
Jonathan Borden wrote: > XML might be more generally represented using something akin to an > s-expression notation by introducing delimeters for an unordered set '[' and > ']' and then we can represent: > > <foo aaa="111" bbb="222" ccc="333"> > <bar ddd="444"/> > <baz/> > <bop eee="555"> > <bing/> > </bop> > </foo> > > as: > > (foo [aaa="111" bbb="222" ccc="333"] > (bar [ddd="444"]) > baz > (bop [eee="555"] > bing > ) > ) > This thread pops up once or twice a year, and it gives me an excuse to point readers to a little thought exercise I did a while back "lambda markup language" I defined an SGML concrete syntax, and wrote 70 lines of Scheme code which produces a program that "executes" a DTD to produce another program. This resulting program, in turn, compiles documents of that type into programs which can print themselves. So what was the point? Well, beyond my curiosity of whether it could actually be done, I think it points to the notion that the distinction between data and code isn't so much a hard line as it is in the uses to which we put it. All data might be considered as programs to the machines which execute them and all programs could also be considered as data for which there are a limited number of machines which are able to do useful stuff with them. XML could be thought of as a program to a SAX parser, causing it to fire a sequence of events, or to a DOM builder, causing it to produce an object model. The power and consequent benefit of using XML comes from the ease with wich one can obtain or build new "machines" to "execute" the data in ways unanticipated by the document's creater. Enjoy, Bill  http://www.blnz.com/lml/index.html
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format