AI Attempts Converting Python Code To C++ – Hackaday

Posted: May 28, 2022 at 8:34 pm

[Alexander] created codex_py2cpp as a way of experimenting with Codex, an AI intended to translate natural language into code. [Alexander] had slightly different ideas, however, and created codex_py2cpp as a way to play with the idea of automagically converting Python into C++. Its not really intended to create robust code conversions, but as far as experiments go, its pretty neat.

The program works by reading a Python script as an input file, setting up a few parameters, then making a request to OpenAIs Codex API for the conversion. It then attempts to compile the result. If compilation is successful, then hopefully the resulting executable actually works the same way the input file did. If not? Well, learning is fun, too. If you give it a shot, maybe start simple and dont throw it too many curveballs.

Codex is an interesting idea, and this isnt the first experiment weve seen that plays with the concept of using machine learning in this way. Weve seen a project that generates Linux commands based on a verbal description, and our own [Maya Posch] took a close look at GitHub Copilot, a project high on promise and concept, but at least at the time considerably less so when it came to actual practicality or usefulness.

Visit link:

AI Attempts Converting Python Code To C++ - Hackaday

Related Posts