Live data from Hacker News

AI converts between hundreds of programming languages

codelanguageconverter.com

31–40 of 60 posts

Re: AI converts between hundreds of programming languages

#33
post #28

I had a particularly funny result: Trying sample #3 (put a record into S3) from Typescript to Python, it reliably... outputs a completely different program, which instead downloads an image from S3 and resizes it in /tmp. Weird.

Ditto for converting sample #3 from Python to Rust...it doesn't even try to interact with S3 at all, it just saves the image to a path specified in args (twice, overwriting the first image). Also, the comments it writes are incorrect.

Re: AI converts between hundreds of programming languages

#35

I have written translators and they are really hard. I think training on code bases is the way to go but I am skeptical overall that it is even worth the effort. The problem is that the translation doesn't get you all the way there. The code produced is buggy and wrong in most cases. You probably get a better result from re-designing and re-implementing. I wonder what the data being trained on even is. It has to incl…

I think it depends on how urgent the migration is, and how much you're paying to fix the bugs.

If the systems works functionally but the infrastructure (?) hasn't aged well, and there's only time / budget to switch horses, that might be the sweet spot.

Re: AI converts between hundreds of programming languages

#36
You can accomplish something close to this with GitHub Copilot (or OpenAI Codex), just write some code in a comment and then say “rewrite the above (language) code in (language)”. Typing the first few characters of the converted version yourself helps with accuracy.

Re: AI converts between hundreds of programming languages

#37
Tried CHIP-8 and so far I got

// TODO: Translate the above Rust into CHIP-8

### TODO

and now it got stuck on emitting some assembly. I don't exactly know what because CHIP-8 doesn't have an assembly representation.

It printed this 16 times

  @0000
    LD V0, [I]
    LD V1, [I + 1]
    LD V2, [I + 2]
    ADD I, 3
    LD V3, [I]
    LD V4, [I + 1]
    LD V5, [I + 2]
    ADD I, 3
    LD V6, [I]
    LD V7, [I + 1]
    LD V8, [I + 2]
    ADD I, 3
    LD V9, [I]
    LD VA, [I + 1]
    LD VB, [I + 2]
    ADD I, 3
    LD VC, [I]
    LD VD, [I + 1]
    LD VE, [I + 2]
    ADD I, 3
    LD VF, [I]
    LD I, V0
    LD V0, [I]

Re: AI converts between hundreds of programming languages

#38

First underwhelming AI post on the frontpage. Thank god our jobs are safe atleast!

Writing code is rarely the problem anyway. Understanding the problem and devising a suitable solution given the full context is where the magic is. And since most humans have a hard time even accurately describing a problem and full context, there's no threat that AI will replace developers.

If we can build up an immense library of clearly defined problems and solutions, with variants which fit with all conceivable unique contexts, then maybe it will become possible for AI to provide useful assistance.

It would be a good goal to do what I describe, as it would result in many fewer bugs in software. The risks then would be either misidentifying the problem (and therefore getting a solution which doesn't fit the need) or providing inaccurate context which allows for suboptimal selection of a predefined solution.

Re: AI converts between hundreds of programming languages

#39
I applaud the effort of whoever put this together, but it is a toy, and a broken one at that. Trivial examples break it easily. When an "AI" like this can take 5,000 lines of SAS in a single file where execution starts at the top and finishes at the bottom with nary a function or external module to be found written by a government employee who hates his job and really doesn't think you should be reading his source code and can turn it in to comprehensible Python that is readable I might be interested. But this is most likely going to be a case of GIGO.
Post reply on HN