Wednesday, September 23, 2009

Yet another compiler posted to github, and first post

Tonight I pushed a pet compiler project I have been working on to github. It's my first code on github and I hadn't really intended on making it public. I'll be quite surprised if anyone is interested in it at the moment, the README doesn't even explain where to start.  Oh well, I will fix it up for public consumption later.  Release early and often.

Every programmer thinks he knows what his perfect language looks like, I am no different. Right now it's little more than turing complete, but it parses a small language and outputs x86 machine code. Only Mach-O binaries on OS X work at the moment but ELF support on Linux is imminent. The assembler is homegrown and done in Ruby but only assembles the subset of x86 needed to compile ... whatever I might call this language in the future.

I'm not sure what the end result will be at all but traits I think a modern language should include are:
  • Immutable data structures
  • Literal notation for hashes, arrays, closures, etc.
  • Multiple block support (possibly io style)
  • Optional OO
  • AOT and JIT compilation to machine code
  • Platform independent, widely ported
  • FFI
  • GC (need I mention this anymore?)
That's it off the top of my head.  Factor, Clojure, Ruby, JavaScript, and C# are languages worth stealing from.  These may overlap but also io, SmallTalk, Python, Java, C, Lisp, Scheme.  I hope to write up some on exactly what I like from each of these languages in the future.  Till then.