Original Tex is not an option, since PDF, today's font formats (and Unicode) and many algorithms didn't exist when Knuth decided no features would be added anymore. Maybe I should hack the source code of pdftex or luatex? I can try that, but that's going to be hard work and I would like to know how far I can get before starting, or if there are easier options (like libraries to write PDF and read OpenType and books or example code of typesetting algorithms).
The beginning of the above paragraph is confused, but I have no time to disambiguate :-)
What you are looking for sounds like a pipe dream. OTOH, see
http://en.wikipedia.org/wiki/Lout
It is apparently a "Haskell-like" language that seems to roughly correspond to what you are looking for.
I have seen lout. It's document description language seems to use nice ideas not used by TeX. But it's dead, since the author has left it to pursue "the perfect typesetting language". Maybe he will have something great to show in a few years. Thanks, MaurĂcio