At this point, the compiler and bytecode interpreter are more or less working. What remains is to add all of the standard library classes needed to make it a useful language: I/O, containers, regular expressions, etc.[dhovemey@nobby]$ cat LongLoop.thud
# With the heap set to 8192 objects,
# this program causes the garbage collector to run.
import System::IO;
var n = 0;
while (n < 9000) {
n = n + 1;
}
IO.out.println(n);
[dhovemey@nobby]$ thud LongLoop.thud
9000
I began this project with the idea that implementing a language like Python or Ruby would be a fairly easy task. Well, it was harder than I thought it would be, but really not that hard overall. Right now, there are about 15,000 lines of source, including comments and whitespace. This is bloated somewhat by the 2,500 or so lines generated by bison for the parser, and also the fact that I essentially recreated the Java I/O classes (streams, readers/writers, etc.) rather than use iostreams.
[Aside: is it just me, or is iostreams ridiculously complicated?]
Eventually, I'm hoping to use Thud as my main day-to-day scripting language. In the longer term, it would be an interesting project to replace the bytecode-interpreter-based virtual machine with one based on LLVM.