
I'm working in a domain (music typesetting) where modelling syntax with trees can be problematic and I'm wondering whether I should work at a lower level - essentially a list / stream of lexemes and some notion of a context stack for processing, tracking when I'm inside a tuplet and the metrical calculation is scaled, for example.
It sounds like your domain is generation of syntax, rather than parsing. It also sounds rather similar to the difference between the high-level language accepted by a compiler (represented by an AST) and the target language produced by a compiler (generally a flat list of almost-atomic instructions and labels). So maybe techniques for dealing with low-level assembly-like languages would be worth investigating. Regards, Malcolm