On May 8, 2008, at 7:01 PM, Greg Ewing wrote:

> Robert Bradshaw wrote:
>
>> A simple grammar -> parser module like you've talked about before
>> seems ideal, and would probably be fairly compact.
>
> Before diving into this, there are a couple of things
> you should take into account:
>
> 1. A parser generator of the kind used by CPython is
> probably not capable of parsing C declarations without
> doing some hackery somewhere.

I think the C declarations are representable by a generative grammar,  
so this method could work.

> 2. There is computation embedded in the current Pyrex
> parser in various places that you would need to track
> down and move somewhere else.

Yes, I've seen this too.

I think most people who have proposed replacing the parser have  
underestimated the complexity and subtleties of parsing Pyrex/Cython  
compared to pure Python. On the surface it is very close to Python,  
but those parts that differ (e.g. type declaration) can be very  
complicated. That being said I think it can be done (I don't want to  
discourage anyone, there are some very capable people on this list)  
and with Python 3.0 on the horizon significant changes will need to  
be made one way or another. Other than that the current parser works  
very well.

- Robert

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

Reply via email to