On 12/22/05, Michele Dondi > Please do not ask me what I have in mind, for I'm > not really sure.
Well, @Larry has been researching attribute grammars for a month or two now, which are an efficient (programmer-wise, not necessarily processor-wise) method for specifying computations over trees. The only syntax we've seen is that of Language::AttributeGrammar and TGE, whose roots come from UUAG. But I'd love to come up with a syntax that feels more integrated into the language. However, the problem with integrating attribute grammars into the language is that you might not know when to clean up attributes, which is extremely important. However it is integrated, it must use proper scoping and no dynamic access so that we can clean things up before the computation is done. The other problem comes from what you were talking about. You don't "print" things with attribute grammars, because the optimal evaluation order is quite unpredictable. You'd have to build up a string (or, say, an IO monad ;-) and print it after the computation completes. I do wonder if there is a monadey thing that we can do to make it feel like the evaluation order was predictable. Luke