4 ms·
I'm writing a Python to C++ translator for https://www.oilshell.org https://www.oilshell.org. The shell itself is less than 40K lines of code and the translato
by chubot 4y ago
I'm writing a Python to C++ translator for https://www.oilshell.org https://www.oilshell.org. The shell itself is less than 40K lines of code and the translator is ~4-8K lines.
And I even have a 50K euro NLNet grant to hire someone!
Brief Descriptions of a Python to C++ Translator https://www.oilshell.org/blog/2022/05/mycpp.html https://www.oilshell.org/blog/2022/05/mycpp.html
---
But I don't think there is anything interesting in this repo. It doesn't show anything that works, and doesn't really make any claims.
But maybe it would be a fun illustration of the limitations of AI. So I would propose that if you can get even 1000 lines of Oil's code translating and running correctly with AI, I will award you a big part of my grant.
I think it's impossible with the state of the art. I don't have much interest in current ML techniques, but I'm credited on a deep learning paper with thousands of citations, so it's not a totally uneducated claim.
---
On the other hand, I'm looking for a C++ / Python / compiler engineer, particularly in the European Union. Please take a look at Oil Is Being Implemented "Middle Out" [1] and send leads my way :) (e-mail in profile)
[1] https://www.oilshell.org/blog/2022/03/middle-out.html https://www.oilshell.org/blog/2022/03/middle-out.html
- sitkack 4y agoAnything you can learn or use from Shedskin? https://github.com/shedskin/shedskin https://github.com/shedskin/shedskin
- chubot 4y agoIt's mentioned in the blog post
- sitkack 4y agoSo it is, I missed the link, thanks. Great post BTW. That is cool you got to cross paths with John Plevyak. That IFA paper is pretty damn great. He worked on Wasm support for Envoy you know. Maybe Plevyak is your compiler writer? :)
- chubot 4y agoAh OK I haven't looked at IFA, but I wonder how it would scale to 40K lines of code? As far as I know that is beyond the state of the art, i.e. a research level problem. Yeah I should get in touch for sure... I remember talking with John about the Apache Traffic Server (formerly Yahoo) and his Python-to-C++ pyc compiler almost 10 years ago! Right now I'm contacting a bunch of people in the EU, since the funders have some preference there. But yes Shed Skin is one of the closest things!
- cycomanic 4y agoYou might want to contact the author of Pythran [1], maybe something can be learned from what they do. [1] https://github.com/serge-sans-paille/pythran/commits/master https://github.com/serge-sans-paille/pythran/commits/master
- chubot 4y agoYeah interesting, I have seen most of these projects (mentioned in the blog post) but not looked closely at Pythran. It does say it's specifically for numeric code. That is what I hinted at in the blog post around use cases for Shed Skin vs. string- and dict-oriented code. There are quite a few numeric accelerators for Python, and I even chatted with Travis Oliphant (of NumPy) about another one he was prototyping. But there are fewer for the kind of program a shell is. mypyc and shed skin are the 2 I mentioned that are most similar. We already have an approach that works, but it just needs "labor".
- UncleEntity 4y agoYou want to translate fully type annotated python to C++ to be able to compile as a stand-alone program? From what I’ve read in the past inferring the types is the hard part (the scheme stuff I saw used abstract interpretation) then just did a relatively simple translation step to end up with C. Well, continuations were also troublesome as were dependency graphs but IIRC that’s because they needed types to compute them. So, yeah, easy peasy if you already have the types.