Hi,

Dag Sverre Seljebotn wrote:
>> Speaking specifically of XSLT, in your framework it would be possible 
>> to write a Transform that dumps out the tree as XML (like your 
>> printer, but fancier), runs some XSLT on it, then reads it back in. 
>> Most of my personal experience with XML has been unimpressive (usually 
>> 'cause it's way to bloated of a tool than needed for the task at hand, 
>> and slow).
> 
> True. But working a little on making transforms easy to write one might 
> find some middle ground, rough example:
> 
> class CoercionTransform(TemplateMatchTransform):
>   match=lambda x: isinstance(x, AssignmentNode) and x.lhs.type != x.rhs.type
>   def coerce_equals_assignment(node):
>     other_usages_of_lhs = self.lookup_functionwide(lambda x: x.name == 
> node.lhs.name)
>     ....
>   coerce_equals_assignment = make_template(coerce_equals_assignment, match)

I would prefer a domain specific language for node selection here. Something
like XPath, but it would do pattern matching against the AST of Cython to see
which optimisations can be applied.

As a starting point, here is a very simple XPath-like language:

http://codespeak.net/svn/lxml/trunk/src/lxml/_elementpath.py


> (Dropping 2.3 support would make this nicer.)

I think that should still be avoided for now, although C code compatibility
with Python 2.3 is more important than having the compiler itself run under 
Py2.3.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to