Bootstrapping assemblers/compilers 2005-03-30


I know perfectly well what to do and not to do, yet I keep getting bitten by this anyway:

Do NOT change the language without first taking a copy of a working environment... NO, checking everything in to CVS/Subversion is NOT sufficient - you need to verify you have a working copy..

There is nothing worse than discovering you've just made a change to your compiler/assembler/parser/whatever, only to try to rebuild it with itself and discovering that the change you thought was entirely benevolent in fact broke the damn thing, and be stuck with something written in a language that doesn't exist anymore (since you just modified and broke the only translation tool).

Luckily, when I did this last night it wasn't too bad - I just had to rewrite about 20 lines of my assembler and dig out an older version of the parser to be able to rebuild it again, then change the lines back, correct a bug and rebuild it once more (after taking copies this time)...

But why will I never learn this lesson once and for all? I've written at least a dozen translators that have been bootstrapped to use code written using itself before, and it seems that every single time I forget about this sooner or later.


blog comments powered by Disqus