Computer.Build: Proposal
Dec 2, 10:59 AM
Abstraction is a fundamental component of software development and computer science. Metaprogramming is abstraction at the source-code level. Ruby (and the popular web framework Rails) popularized first-order metaprogramming, but it was certainly not the first language to support it. Lisp is arguably the most powerful language for metaprogramming, but most Lisps are weighed down by decades of legacy and limited libraries. Clojure is a modern take on Lisp implemented atop the Java Virtual Machine. Both Clojure and Ruby allow for metaprogramming and the creation of Domain-Specific Languages (DSLs), making them good candidates for the creation of Computer.Build: A DSL for defining microprocessors.
Computer.Build will be a high-level language for defining computer processors and their instruction set. Most computer hardware design today happens in VHDL or Verilog, neither of which support metaprogramming. Bluespec is an interesting step, but it still doesn’t allow for the level of abstraction Computer.Build requires. As such, an intermediate representation between Computer.Build and VHDL or Verilog must be created, forcing two layers of metaprogramming. The high-level Computer.Build code will be compiled/translated/evaluated to an intermediate hardware description language, which is then translated to VHDL. The end goal is an easy-to-use, high-level language for defining microprocessors that can be compiled into an FPGA design and run in hardware.
As a computer science research project, Computer.Build will be implemented in both Ruby and Clojure. The high-level DSL will have two variants, although they will achieve functional parity and look fairly similar. Computer.Build will require metaprogramming and code generation, both valuable features in a language. The primary goal of Computer.Build is to compare and contrast the metaprogramming facilities available in Ruby and Clojure, while the secondary goal is to create a useful tool for rapidly prototyping microprocessors. There is some potential for using Computer.Build to optimize key parts of a program by compiling them to hardware, allowing for massive speedup for some specific applications.
I will develop Computer.Build during the Spring 2010 semester at Rensselaer Polytechnic Institute under the supervision of Mukkai Krishnamoorthy, a professor at RPI, supervisor of Rensselaer Center for Open Source, and a great mentor to me. By the end of the semester, I will produce a technical paper comparing and contrasting the metaprogramming facilities in Ruby and Clojure. I will also share my progress here, at Hacker|Engineer, as I reach significant milestones or make interesting discoveries. The code will be published on Github under a license to be determined.