Hey Paul, welcome to the list :-) On 8/10/06, paul cannon <paul-clpython at nafpik.com> wrote: > I saw some mention of coroutines in the list archive. I spent some time > working on implementing some python-ness in lisp, and have a partially > complete code transformer that can make generators and coroutines > possible. I'm certainly curious about your work. CLPython fully supports Python's generators except for the fairly new 'yield as expression' feature ("x = yield y"). By tracing function 'rewrite-generator-funcdef-suite you can see how a generator is rewritten into a state machine. Rewriting of generator's function bodies into the state machine made me feel an assembly programmer: tagbody, goto... :-) Most of the rewrite rules were straightforward, but handling 'yield inside 'try/except correctly required some care. As for getting it running on SBCL: probably the heavy use of custom declarations of the form "(declare (pydecl ...))" and environment inspection functions, are the hardest issues in making CLPython portable; but I have to admit I looked only briefly at what other implementations offered in this aspect. - Willem
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4