Forwarding some correspondence with an author of another Python-to-C  
compiler:

On Apr 7, 2008, at 4:56 PM, Rahul Garg wrote:
> Quoting Robert Bradshaw <[EMAIL PROTECTED]>:
>
>> Have you heard of Cython before? Do you have any thoughts on how it
>> compares/overlaps/relates to Spyke?
>>
>> - Robert
>
> Hi.
> 1. Cython and Spyke have certain differences but mostly related to the
> surface syntax accepted. From what I understand (and do correct me if
> I am wrong) Cython is a Python like language but Cython code isnt 100%
> Python and does not run on the Python interpreter.
>
> Example :
>
> Lets assume you had the following  Python code :
>
> def f(x): return 2*x
>
> If you want to convert this to C, then from what I understand in  
> Pyrex you would write a different file with the extension pyx. The  
> function would look like :
>
> cdef int f(int x): return 2*x
>
> Now this code is very similar to Python but will not run on the Python
> interpreter. Spyke on the other hand would want you to declare types
> within the Python source itself :
>
> "int -> int"
> def f(x): return 2*x
>
> This string is discarded by the Python interpreter so its still valid
> Python code and will run on the Python interpreter as well is capable
> of being compiled. So its mostly a matter of surface syntax currently
> and it might even be possible to interconvert the 2 formats.
>
> Cython is also ahead in terms of language supported and probably give
> better performance currently. But Spyke takes the philosophy that  
> the code
> should run on the Python interpreter so has no additional keywords etc
> and all additional info is specified through mechanisms ignored by the
> Python interpreter. Spyke copies ideas from Python Language Wrapper
> project (PLW) project. You can get a paper on PLW here :
> http://www.cs.utk.edu/~luszczek/pubs/plw-200605.pdf

This is a difference, but just on the surface. We have a goal to be  
able to support this kind of thing as well (though we don't intend on  
making the old syntax obsolete, as it is very easy to use when there  
are a lot of types).

> 2. Long term : Spyke is actually for my thesis on compiler
> optimizations for dynamic languages. Some experiments with parallel  
> constructs are also on the roadmap. Also I will focus heavily on  
> loop optimizations and such for numpy code. Spyke does currently  
> understand how slicing and indexing work and numpy arrays are sort- 
> of native datatypes for Spyke. I also intend to implement a whole  
> program compiler. I have a number of ideas related to targeting a  
> modified Python interpreter but those probably will be in a  
> different branch.

That's cool. Most of the differences seem to be in this point, though  
we hope to get better NumPy support soon.

> 3. Integration : Spyke is written in Java mostly. On code level
> therefore its difficult to integrate Spyke and Cython but ideas can  
> freely go back and forth. I will follow Cython closely. Many of the  
> issues remain the same since the semantics of the language  
> supported is similar.

We'll keep our eye on Spyke too.

Thanks for answering. Do you mind if I forward this response to the  
cython mailing list?

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

Reply via email to