Bringing FORTRAN to the table

What a difference a month makes. I believe that to get a lot done, one should focus on one thing for a month. Then it is time to move on and regain perspective.

During the month of June, I created a Fortran compiler for the simulator. I had this idea on a plane in the last days of May. I sketched out what I remembered about the Fortran 4 standard, and some of the non-standard implementation in the GE-115. At this point, it is (almost) done. There are a few more features I would like to add, but they will come in time.

I am very proud of this accomplishment. I recognize that perhaps I am the only human on the planet who cares, but I am okay with that. The time was very intense and required a great deal of focus. During this time, I remained part of society, so I was not completely isolated! Emerging from this process, I feel good about having spent my time this way. During the last week, I acquired Covid for the first time. I found it more difficult to focus, and I may have made a few poor implementation decisions. In the end, everything can be fixed, can't it?

Fortran was my first language, my mother tongue in software. I wrote long, complex Fortran programs, and used the line printer to print graphs of equations. I learned so much about coding in Fortran, even though the control structures are quite primitive. I moved from this version of Fortran to WatFor at the University of Waterloo, then WatFIV, IBMs Fortran G and H, Cyber 160 Fortran, RatFor and DIBOL. Since those days, I have learned hundreds of different languages, but Fortran was always my home, the thing which I used as an unconscious touchstone for comparisons.

In writing this compiler, I had to confront my love/hate relationship with the language. Fortran was designed to help simplify encoding complex mathematical expressions. Consequently, it has a ton of implicit conversion rules. For example, if you do an integer divide, the result is an integer, unless you reference a real or double precision floating point variable, in which case the divide becomes a real or double precision divide. This made the parser and the code generator more complex.

A related issue is the idea of implicit typing. Variables do not need to be declared in Fortran. You can just use them with the understanding that if they begin with the letters I through M, then they are integers, otherwise they are real. There is limited support for character and logical variables.

Another issue is the GO TO statement. In the years since, I have learned to block my code so that I never use a GO TO anymore in any language. When you go back to Fortan 4, it becomes important to embrace this control structure once again. It does come back to you! There are no while loops or repeat .. until, there is the old reliable DO loop, which is the archetype for looping in many, many languages. How many times did I write a program that began with a DO loop and then I would have to figure out what happens inside the loop?

So now what? Once I feel the compiler is reliable enough, which may take another month of testing, then I will have to find a way to share this with people so they can try it out. I expect that I will use some kind of wrapper on the library, and then push it out on a web platform. It is currently a desktop application. The other activity for July is to follow up with some of the inquiries I've made for additional information to see what I can glean from the world.

Comments

Popular posts from this blog

How it got started

The Student Computer Operator

So much has happened