The current implementation traverses the parsetree and directly produces the Format stream. This works well when the desired nesting structure of formatting boxes coincides with the nesting structure of the parsetree. When the desired formatting involves different nesting of boxes than the parsetree, the code gets very complicated and non-compositional.
An alternative is to introduce an intermediate data structure which is constructed by traversing the parsetree, and then it is traversed to produce the Format stream. This would enable much simpler and more flexible differences between nesting of boxes relative to parsetree structure.
Currently all the various "sugar" functions, as well as Fmt_ast.block, are partial steps in this direction already.