16th July 2008, 04:16 pm
I do not have strong feelings about XML, be it for or against it. I don’t use it much because I use either S-Expressions with Scheme or Lua tables with Lua. I believe XML can be helpful, but people need to know how to use it.
I have come across an application of XML to store an animation, frame by frame, like the animated GIFs of old. Each frame is then an image, stored as an XML element. The bizarre part is that every pixel is stored as an individual element inside the frame:
<frame id="Frame001" width="180" height="240">
<array type="Int8">
<Int8 value="230"/>
<Int8 value="012"/>
.
.
.
</array>
</frame>
I believe this is the most “by the book” implementation. But this is far from optimal. When inspecting the files with a text editor (yes, I needed to do that) it was very painful. Besides, the files are huge! Why not be sensible and use Base64 encoding for the image part:
<frame id="Frame001" width="180" height="240">
TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg
dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu
dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo
.
.
.
</frame>
Nobody could inspect the information of previous format anyway, the files gets much smaller, one could edit them by hand (like I did to copy frames between animations). And no, the files are not being compressed because they are part of a build process.
It only remains to be seen why it is done this way. I believe it was a mixture of a non-too-intimate knowledge of the technology and a desire to use it in it “purest” form, like those people who must design their programs with all the design patterns known to man. With time they may learn that a sensible dose of pragmatism is very healthy.
2nd July 2008, 11:52 am
The XII Brazilian Symposium on Programming Languages is going to be happen in my home city of Fortaleza, on August 27th-29th. The programme looks very promising, with sessions about Software Transaction Memory in Haskell, concurrency with Lua (with the main architect of Lua, Roberto Ierusalimschy from PUC-Rio) and an invited talk of Shriram Krishnamurthi, the author of Programming Languages: Application and Interpretation, among other interesting stuff. I hope to be there, I even get to see my family and my friends.
1st July 2008, 11:54 am
Doing some research about compilers, interpreters and virtual machines, I have gathered some bibliography from several resources. Here it is, in no particular order:
- Essentials of Programming Languages, by Daniel P. Friedman, Mitchell Wand and Christopher T. Haynes
- Programming Language Pragmatics, by Michael L. Scott
- Smalltalk-80: The Language and Its Implementation, by Adele Goldberg and David Robson
- Writing Compilers and Interpreters: An Applied Approach Using C++, by Ronald L. Mak
- Modern Compiler Implementation in ML, by Andrew W. Appel
- Lisp in Small Pieces, by Christian Queinnec
- An Incremental Approach to Compiler Construction, by Abdulaziz Ghuloum
- Let’s Build a Compiler, by Jack Crenshaw
- Structure and Interpretation of Computer Programs, by Harold Abelson and Gerald Jay Sussman, with Julie Sussman
- Advanced Compiler Design and Implementation, by Steven Muchnick
- The 90 Minute Scheme to C compiler, by Marc Feeley
- Compilers: Principles, Techniques, and Tools, by Aho, Lam, Sethi and Ulman (the “Dragon Book”)
- Engineering a Compiler, by Keith Cooper and Linda Torczon
- Mike Pall’s guide to the Lua source code
- Anton Ertl’s papers
- David Gregg’s papers
- Michael Franz’s papers
- Garbage Collection: Algorithms for Automatic Dynamic Memory Management, by Richard Jones and Rafael D Lins
- Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp, by Peter Norvig
- The Art of the Interpreter of, the Modularity Complex (Parts Zero, One, and Two), by Guy Lewis Steele, Jr. and Gerald Jay Sussman
- Compiler section on readscheme.org