Let's translate a program! #258
Replies: 1 comment
-
EpilogEncouraged by the Lunar program example, I tried a few others. The first was tictac.bas, The results on that were mixed. Gemini was able to produce a working copy after a few corrections. One of the issues with that program is that a lot of the logic in the program is buried in data statements (tables). I tried it with "agent mode", and the result was Gemini got tangled in a series of (apparently) non-ending refactors that just produced more bugs. Non-agent mode appeared to not have this issue because it just did a fairly mechanical translation. The next try, admittedly a moonshot, was to ask Gemini to translate pcom.pas to a C program. This can be accomplished by automatic programs such as p2c. Gemini announced "that is a very complex task". asked if it could do that, Gemini said yes, and produced about 300 lines of code and stopped. Told to continue, it produced 100 more lines. I kept hitting up arrow and "continue", each time getting about 100 more lines. pcom.pas is about 10,000 lines of code. Meaning 100 "continues" to finish the program, at about 5 minutes per try. So... 8 hours of hitting up arrow and repeating "continue" and waiting each time. No thanks. ResourcesI think its nice that all of these AI resources can be plugged into vscode, my preferred editor, and I suspect many of your editors as well. The result is apparently that these AI engines can handle small programs, say 1000 lines or less, but fail on bigger programs. It could well be that the AI engines out there are programmed to not take that much time on any one particular problem, otherwise one user could hog the entire server. One alternative is to use a private AI implementation. One of these is from Nvidia, which provides a boxed GPU that runs an OpenAI model. Its not cheap at $4,000 (yikes!). We'll see. At the present time, AI is interesting to me but not that useful. I have turned out 1000 line programs in a few days, and most of my important programs are in the thousands of lines range, as are any open source programs I might be interested in working with. This also tells me that "vibe programmers" are making small programs, and the ones most likely to be impressed by that are beginning programmers. Not that there is anything wrong with that! If AI can generate short programs in Pascaline on demand, that is useful both too me and users of Pascal-P6. TrainingWhich brings us to the last subject. The current models are trained on open internet data. This means they are good at mainstream languages, which includes ISO 7185 Pascal (yes, it does!), but does not include languages like Pascaline. Thus the ability to train the models on new languages by feeding them Pascaline documentation is a matter. So far my efforts to do that have been mixed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Let's translate a program!
So the Wall Street Journal this morning says that Gemini 3 is the most advanced AI model out there. Let's test it shall we?
So I installed Gemini code assist and gave it the problem, "please translate lunar.bas to ISO 7185 Pascal", as in the file ./basic/prog/lunar.bas.
Here is the program:
The compile and run:
It worked out of the box!
I'd have tried more with it, but the next question caused it to completely lock up. The question was "were did you put the file". It answered that, being AI, it could not create the file, then sailed off into space[1].
Alright, lets do that with copilot:
I'll bet you spotted the first issue with that, the lack of header files.
Told that was an ISO 7185 no-no, copilot fixed it and then I compiled it:
Copilot failed because it tried to mix Turbo/Delphi Pascal into the program.
Copilot takes this input and generates another version. Note I am using the method of just giving copilot the output of the compiler, no other hints (ie, you are a big boy, you can figure it out):
By the way, I have to mention, using pc (the integrator) is soooo much nicer than using the scripts.
Copilot fixes the errors, and the result is (complete with run):
Ok, so both AIs got to the result. Copilot needed more prompting, but it didn't crash. The Gemini program got better, but less reliable. Isn't that a statement of programming today?
Why does translation work so well with AI?
Well, because a program, a working program, is a complete and accurate description of what to do. This also says that AI is good for explaining programs as well.
Will AI obsolete me?
Actually, to the contrary. This says that I can, either now or in the future, translate any program out there to Pascaline. That makes me more productive, as well as blowing the scope of Pascaline (or any language) wide open.
Stay tuned.
[1] Judging by the problem reports, this is a standard issue with Gemini.
Beta Was this translation helpful? Give feedback.
All reactions