# Scientists are using artificial intelligence and large language models to rewrite old code in modern languages

**URL:** <https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598>\
**Category:** Uncategorized\
**Created:** [April 20, 2025, 5:35am UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598 "2025-04-20T05:35:46Z")\
**Posts on this page:** 8\
**Page:** 6

<div class="post-metadata">

**Author:** ![jorgeg](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jorgeg/32/6835_2.png) [@jorgeg](https://fortran-lang.discourse.group/u/jorgeg)\
**Post date:** [June 14, 2026, 2:59am UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/102 "2026-06-14T02:59:31Z")

</div>

The problem, as someone pointed out earlier, is the lack of connection and development between the standard committee and a compiler to implement all the features that are proposed or accepted.

So we are left with the vendors adopting and implementing things, this is why do concurrent is implemented differently in the Nvidia, amd, cray, and gnu compilers.

Fortran can do GPUs but portability across vendors is not a given. Kokkos attempts this and mostly succeeds because C++ got premier support during the first big GPU push.

---

<div class="post-metadata">

**Author:** ![gronki](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@gronki](https://fortran-lang.discourse.group/u/gronki)\
**Post date:** [June 14, 2026, 7:43pm UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/103 "2026-06-14T19:43:17Z")

</div>

> [@ivanpribec](#):
>
> This has been said many times before, but an advantage of C++ are the generic containers including `std::map` (an associative array), `std::unordered_map` (a hash table) and the associated algorithms.

I think that sums up the issue. A language without good handling of unstructured data is _not_ a modern language, period. As far as I know, LFortran is the only compiler that does provide some implentation of a hashmap, although not standardized.

General purpose languages won.

---

<div class="post-metadata">

**Author:** ![gronki](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@gronki](https://fortran-lang.discourse.group/u/gronki)\
**Post date:** [June 14, 2026, 7:55pm UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/104 "2026-06-14T19:55:47Z")

</div>

Not rewrite but modernize enough to provide a bind(C) interface and a Python ctypes binding. Claude struggled with understanding fortran rules (for example regarding common block declarations). I would say we managed to get it done the 5th time, but it required frequent corrections. It was an old code from '82 with dozens of common variables and LLM was very good at following all the dependencies, but tight guidance over architecture of the solution was needed. “Autonomous coding agents” are incovenient to me for one reason: they make decisions I disagree with requiring rollback and waste of tokens, I prefer much tighter control and checking their every step.

---

<div class="post-metadata">

**Author:** ![jacobwilliams](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jacobwilliams/32/10_2.png) [@jacobwilliams](https://fortran-lang.discourse.group/u/jacobwilliams)\
**Post date:** [August 30, 2026, 7:35pm UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/105 "2026-08-30T19:35:37Z")

</div>

Here’s another of my AI-assisted C++ to modern Fortran conversions: [Degenerate Conic | Brouwer-Lyddane Elements](https://degenerateconic.com/brouwer-lyddane-elements.html)

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [August 31, 2026, 4:49am UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/106 "2026-08-31T04:49:46Z")

</div>

Beautiful. I can see you are using your own [pyplot-fortran](https://github.com/jacobwilliams/pyplot-fortran), which is constructing a Python string and evaluating it in Python (right?).

I figured, let’s translate Matplotlib to Fortran, to be more consistent with this thread:

- [GitHub - certik/fplot: Fortran plotting library · GitHub](https://github.com/certik/fplot)

It is 100% pure Fortran, the usual pyplot-style API, and it has svg, png, pdf (and even gif!) backends, the backends are all in pure Fortran, they generate the svg text, or png/pdf/gif binary. I embed the glyphs of a font directly into Fortran sources, support latex-style math rendering, etc.

I needed something to use in the JupyterLite notebooks that LFortran now supports, so since it runs in the browser and must be fast, I needed to generate svg/png directly in pure Fortran.

Anyway, it was super easy to do this thanks to AI, so I think we can now have the full ecosystem from plotting, file formats everything in pure Fortran.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [August 31, 2026, 10:51am UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/107 "2026-08-31T10:51:21Z")

</div>

In my transpilers to Fortran I skip plotting code, but eventually I would like to translate simple plotting code from R and Python, maybe using fplot. There is already a project by the same name using Gnuplot. You could consider renaming your project to avoid confusion.

> **[GitHub - jchristopherson/fplot: A Fortran library providing a convenient interface...](https://github.com/jchristopherson/fplot)**
>
> A Fortran library providing a convenient interface for plotting with Gnuplot.

---

<div class="post-metadata">

**Author:** ![fxm](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/fxm/32/5726_2.png) [@fxm](https://fortran-lang.discourse.group/u/fxm)\
**Post date:** [August 31, 2026, 11:31am UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/108 "2026-08-31T11:31:33Z")

</div>

I had just opened an [issue](https://github.com/certik/fplot/issues/18) about that. Perhaps a matplotlib-inspired `fplotlib` (or similar) would not just avoid confusion but also be fitting to signal its similarity to matplotlib.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [August 31, 2026, 2:12pm UTC](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598/109 "2026-08-31T14:12:16Z")

</div>

Yes, there is also a similar effort by @krystophny in [GitHub - lazy-fortran/fortplot: Native plotting in modern Fortran · GitHub](https://github.com/lazy-fortran/fortplot). Christopher, I know in the past you used some functionality implemented in C for images / fonts, but looking at your repository now, it seems it is also now 100% pure Fortran? If so, that’s the way to go.

Christopher and I also prototyped using the [vega-lite](https://vega.github.io/vega-lite/) JSON format as the intermediate representation of plots, which allows to have different frontends (in different languages) and different backends. But I still don’t know if it is worth it or not, and if there are performance implications of using JSON in the middle (I think we would need to figure out how to keep the data itself in internal datastructures, just reference it from JSON, for speed). Now when we figured out how to do everything in pure Fortran, perhaps it’s less important to have a clean intermediate representation.

One thing we can also try to figure out is to have various independent fpm packages for fonts, png, gif, etc. output. I think those would be useful to other libraries also.

[Previous page](https://fortran-lang.discourse.group/t/scientists-are-using-artificial-intelligence-and-large-language-models-to-rewrite-old-code-in-modern-languages/9598.md?page=5)
