Code Scrap Heap

Any Eiffel code on this page requires an ancient version of the SmartEiffel compiler, back when it was called "SmallEiffel".

  • j0: An interpreter for a subset of the J language. http://cs.stanford.edu/~blynn/scrap/j0.git

  • BAD library: C library stuff I wish were built-in: lists, dynamic arrays, hash tables, crit-bit trees. http://cs.stanford.edu/~blynn/scrap/bad.git

  • assorted sorts: Short and sweet sorting algorithms in C: http://cs.stanford.edu/~blynn/scrap/sort.git

    An ancient implementation of "pigeon sort": pigeon.c.

  • bender: The beginnings of a compiler for a Limbo-like language for Android. Contains a Dalvik assembler.

  • hello2x, touch2x: Test programs for the GP2X, one of which employs the touchscreen.

    Blog posts: [1], [2]

  • range encoding: A brief excursion into an ingenious compression method. http://cs.stanford.edu/~blynn/scrap/crush.git

  • wiki processor: Writing documents in a wiki format soundly beats editing raw HTML. It took me a long time to realize this due to geek snobbery, and a phobia acquired after seeing generated HTML from once-popular web editors.

    In a stroke of genius, I realized I could design a wiki format that looked like a text document yet could be converted to HTML in a well-defined manner. Why didn’t the internet start with such a format? At once I began putting my ideas into practice, learning Python along the way.

    I abandoned it even more rapidly when I discovered AsciiDoc a few days later. I had also missed txt2html and RST (reStructuredText).

  • HTML renderer: How hard is it really to write a browser? I don’t know, because I didn’t get far. http://cs.stanford.edu/~blynn/scrap/fussy.git

  • linstall: Both Windows and Linux tolerate extraneous bytes on the end of executables, With a cross-compiler, we can use this to build self-extracting executables for both platforms from Linux. http://cs.stanford.edu/~blynn/scrap/linstall.git

  • xmmspipe: There was a time when almost all Windows users played their MP3s with WinAmp. XMMS was Linux' answer. This plugin sets up a named pipe through which this once-ubiquitous music player can be controlled.

  • DDR Does Recurse: I wanted to play a dancing game I had bought ("Digital Dance Station", now defunct) under Linux, hence this project. It was around the time I turned my back on object-oriented programming, so I later converted the project to C. Later still I found StepMania.

  • compiler? I’m slightly perturbed I have no memory of creating this long-lost tarball. It looks like I started to write a compiler for an Eiffel-like language.

  • synthesizer? Another bunch of files that I cannot recall writing appears to be the ruins of an attempt to learn Ocaml and build a simple synthesizer.

  • ZZT clone: What started as an RPG somehow morphed into a ZZT emulator. For memory, I grew tired of reverse engineering the data format.

    Files: badoil.tgz.

  • ray tracer: Before I rebelled against object-oriented programming, my favourite language was Eiffel. I set out to prove its superiority in the Third Annual ICFP Programming Contest. I had to build a ray tracer in three days, complete with constructive solid geometry. My program crashed and burned in the last round.

    Final entry: icfpfinal.tgz.

  • problem solving framework: For a object-oriented programming course, I wrote code that solves simple problems via some sort of search. I can’t remember the details, though I do recall Jeff Kingston’s rough instructions: start with a "blackboard", a shared working space that all algorithms can see. Then each algorithm attempts to make some progress, perhaps leaving more clues for other algorithms to use. Unfortunately I didn’t get far.

  • 9P file server: Rob Pike happened to be taking a sabbatical at my university one semester, and loosely supervised a project: a Linux file server that uses the 9P protocol. The code is terrible, as it was my first attempt at network programming, but it worked.

    Files: 9ps.tgz.

  • computer graphics: Long before dedicated graphics cards were commonplace, I wrote a ray tracer, a polygon shader, a texture editor and a real-time 3D first-person maze for a computer graphics course. In the last program, you could insert walls on the fly; my program would recompute the BSP tree and remove new hidden surfaces.

    The binaries still work on DOSBox.

    Files: cg.tgz.


Ben Lynn blynn@cs.stanford.edu 💡