<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I'm not familiar with CPS transforms; what are they good for? Are you<br>adding tail-call optimisation to AS3 or something like that?
</blockquote><div><br>Yes, or user-level threading, etc (see narrative js). <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">FYI, I did make a start at exposing expression-level stuff in the
<br>hand-crafted DOM interfaces (there should be some of this in Subversion)<br>but lately I've been spending most of my hack-time on projects built on<br>top of metaas, rather than on metaas itself.</blockquote><div>
<br> Any tips at what to look at? My basic, exact scenario is that I want to add some function applications throughout expressions, like<br><br>a * b + 3 => f(plus, f(time, a, b), 3)<br><br>I would have done it at the antlr level, but I want to do some optimizations and deal with shadowed variables etc in special ways.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Yep. Support for this is simply not implemented yet. LinkedListTree<br>probably needs to supply its own implementation of dupTree() to
<br>duplicate all the subclass-specific state. The fiddly bit will be<br>duplicating the relevant sub-segment of the token-linked-list, and then<br>assigning the correct start/stop tokens in the duplicate tree nodes.</blockquote>
<div><br>Yeah, as I've slowly realized what's going on underneath :) <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">In the cases where the manipulation doesn't fail, does the code look
<br>'sane' when serialised back to text again? If you're using dupTree() I<br>would expect it to be quite broken.</blockquote><div><br>Most of the time (if I encounter them again, I'll let you know).<br></div>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">So, it would be really helpful if you could send some simplified<br>unit tests that demonstrate these problems. I can then work to make the
<br>tests pass.</blockquote><div><br>When I encounter more, I'll try. <br></div><br>For anyone else on the list, what I ended up doing for particularly hairy bits of my visitor so far is writing a function astToString, and writing the ast I wanted the subtree to be transformed into as a string with the original subtree being transformed using that function. I'd then run the string through the fragment parser and return the generated ast for reinsertion (which needs lots of testing). The main trick is writing astToString (reuse the tree printer internals, except you need to temporarily disconnect a subtree from a parent if it is connected to get the tokens right, and swap it back in after - I checked if the parent =
parent.parent, and swapped in a dummy node temporarily if so in order to not disturb tokens).<br><br>- Leo<br> </div>