The most exciting thing about this world is its ever changing quality.

Saturday, November 28, 2009

Have your own toolchain

Toolchain provides you the capability being able to compile your code in your way to be run on your own hardware platform. For most of programmers, in majority of their career, are trying to learn to speak (code in) one or more common language, where syntax has been predefined, compilation approaches have been chosen, assembly set has been given, hardware has been decided by the boss :-).

Now, in an ideal world (I did say 'ideal'), you would design yourself an extremely powerful chip, with unlimited number of processing cores, running any instructions in nano-second.
In an ideal world, you would probably want to cook your own assembly set to be run on this powerful chip, the first one for me would be - SORTITALLOUT.
In an ideal world, you would also probably consider to write your own compiler, implementing those funky optimisation algorithms you came across only in research lab decades back in your youth.
At last, an easy one - one thing pretty much everyone else is doing nowadays - defining your own language syntax, yeah, you are right, a new language, and convince whoever you can convince to use and re-populate your civilisation.

To have all four in place, you are pretty much in control of your own life. In real world, we tend to settle with compromise. Here we tend to pick one or two of these four items and reuse some efforts other brilliant geeks have been messing with. The normal ingredients in the toolchain include:

  • An assembler - to convert your assembly instructions into 000111....1..0., the only format machine really understand.
  • A linker - to put pieces of brilliant moments together into a big 000111......1100.
  • A compiler - with which your favourite programming language into a bunch of assembly - lower level instruction set. Yes, you are right, who need another level if we have assembly defined already? Many good and bad memories prove that you might have a point there, as in the early days, we all have one weapon call assembly code.

These three are absolutely necessary for a micro-version of toolchain. Now if you have some code already, pump them bottom up, you will be talking to your machine now. However, if you intend to get serious, you will need the following:

  • A debugger - whatever interface it is (my personal view is GUI debugger suck more than they contribute). This is a whole topic by itself and I don't really know much about so I will skip it.
  • Libraries - only if you ever want to rebuild the whole new world again all by yourself, you are going to need some of proven work done by other genius just like you, some common funcationalities everyone will come across. "This idea that there is generality in the specific is of far-reaching importance. — Douglas Hofstadter, Gödel, Escher, Bach"
  • Utilities - copy, dump, whatever verb you can think of. These tools are really food for work, and thought.

No comments: