After two weeks without any writing, here comes another status update of my GSoC (and I promise I’ll do it more frequently).
Today I’m working on PEP 342 – “Coroutines via Enhanced Generators”. I’ve finished to implement the .send() method and all the stuff it should do “behind the scenes” (e.g. push the value into the frame stack).
Last week some other PEPs and small changes were supported as well.
PEPs 308 (conditional expressions) and 343 (with statement) were already supported, I just needed to write tests and remove a SyntaxWarning for conditional expressions. PEP 352 (BaseException and raise “string”) is now supported as well.
Some changes were made to Grammar2.5 because pyparser could not read it the right way. Those changes were already present to Grammar2.4. The main problem is that when the parser finds a rule that has alternatives (like, ‘is’ | ‘is’ ‘not’ ) and the first alternative matches (imagine it trying to match ‘is not’, it will match ‘is’) it doesn’t look for the other alternatives and then fails (because there is no rule that matches a ‘not’ after an ‘is’). The solution in that case is to change the order (which doesn’t make much sense, before looking the parser’s code), so the rule should be ‘is’ ‘not’ | ‘is’.
Next steps: check PyCode magic number and finish PEP 342