Fortran is often perceived as a language suitable exclusively for numerical applications and not much else. However, digging a bit into the history I’ve discovered that a few computer emulators were written in Fortran:
Launched in 1971, the 4004 was Intel’s first microprocessor. It was part of the MCS-4 micro computer set used in the Busicom electronic calculator (an emulator can be seen here). The index of the MCS-4 Users Manual mentions a MCS-4 Fortran Assembler/Simulator Package. According to another page this was a cross-assembler running on a PDP-8 and implemented in Fortran IV.
According to DEC employee Larry McGowan in How the PDP-11 Was Born, a simulator called SIM-11 was written for the PDP-10 which was used to test software and early programs before the first PDP-11 prototype was built. The PDP-11 was released in 1970.
In the book FORTRAN TOOLS: For VAX/VMS and MS-DOS (1989), the authors Jones & Crabtree (presumably employed by Hughes Aircraft Company, later sold to Raytheon) provide listings for a virtual machine used to run a Fortran-like interpreted language called spl (simple programming language).
SPICE2 was computer program used to simulate semiconductor circuits developed at the Electronics Research Laboratory at the University of California in 1975. I guess it was not an interpreter, however the input decks might be seen as an early example of domain-specific simulation language. SPICE2 is not to be confused with the NASA SPICE information system. The Cedar EDA program (briefly named JuliaSPICE?) seems like a descendant of SPICE2 written in Julia. (It appears to be closed-source.)
Are you aware of any other historical emulators or interpreters written in Fortran? Do any of your Fortran programs in use today have an embedded interpreter? In case yes, what do you use it for?
NASA’s Copernicus contains a basic equation parser, which allows the user to input equations that can be included in the optimization problem, without having to compile anything. The parser is written in Fortran, and is similar to other Fortran equations parsers out there.
@jacobwilliams, Copernicus looks impressive! I noticed EIS-2 is missing from your list of equation parsers. It was featured at FortranCon 2020 in the talk from Christopher Brady. The book Illustrating FORTRAN (1982) also has an exercise on reverse polish notation illustrating the use of stacks.
I have used two interactive FORTRAN77 interpreters written in Fortran but a cursory search
did not produce any copies of them.
There are at least two scheme interpreters written in Fortran
DISCUS had/has a FORTRAN77-like interpreter
I thought there was a FORTRAN77-like interpreter in ROOT from CERN,
but if there was it appears to be gone.
Westinghouse had a shell program written in fortran that incorporated graphics, a functional language and extensive math functions and a set of operators for working on tables of numeric values and self-describing data files that has been in use for at least thirty years although I do not know if it is actively maintained.
If I get some time I might be able to track some of those down. I know the scheme interpreters are used in actively maintained programs but I have lost track of some of the others
The NCL scripting language for NCAR graphics had a huge amount of Fortran in it and I believe the original was all Fortran-based; but I think it migrated toward C; not sure but it had a huge amount of Fortran libraries available from NCL and is still available but no longer supported.
By the looks of this open letter from 2019 they’ve already migrated to Python. This transition guide shows the same examples side-by-side in NCL and Python. There is quite a resemblance between Fortran and NCL. For the purposes used Python is not that different either.
Interesting. I was not aware of NCL. This directory has a lot of interpolation code. Some of which I’ve never seen before (e.g. SPLPAK). Definitely something that needs to be rescued and modernized!
S is a language that was developed by John Chambers and others at the old Bell Telephone Laboratories, originally part of AT&T Corp. S was initiated in 1976 as an internal statistical analysis environment—originally implemented as Fortran libraries. Early versions of the language did not even contain functions for statistical modeling.
In 1988 the system was rewritten in C and began to resemble the system that we have today (this was Version 3 of the language).
LISPF4 is a Lisp interpreter originally written in Fortran.
Thinking of S/R; DATAPLOT from NIST is an interpreter as well as a huge amount of Fortran statistical code, and includes vast amounts of documentation and generates plots as well.
The IBM Fortran H compiler (late 70s?) was largely written in Fortran H . Fortran H had extensions for bitwise operations and structures. I haven’t been able to find source for it, though.
but no code. I have heard similar (a lot of bootstrapping Fortran code) but have never seen it
and I looked for it a while ago; but more-or-less just out of curiosity.
Fortran compilers were on machines with as little as 4K words of memory (might be off, but still amazingly little). Amazing they got it working.
Some current projects are M_matrix: Fortran callable version of old matlab-like interface, by @urbanjost
syntran, by Jeff Irwin, which can run the following code (taken from the Readme.md):
{
// Calculate π
let pi = 0.0;
for k in [0: 10]
{
pi = pi + 1 / (16.0 ** k) *
(
4.0 / (8*k + 1) -
2.0 / (8*k + 4) -
1.0 / (8*k + 5) -
1.0 / (8*k + 6)
);
}
pi;
// 3.141593E+00
// x is 30 degrees (in radians)
let x = pi / 6;
// Calculate sin(x) using Taylor series
// Initialize Taylor series terms
let xpow = x;
let factorial = 1;
let sign = 1;
// Sum odd terms only
let sinx = 0.0;
for k in [1: 10]
{
sinx = sinx + sign * xpow / factorial;
xpow = xpow * x ** 2;
factorial = factorial * (2*k) * (2*k + 1);
sign = -sign;
}
sinx;
// 4.999999E-01
}
The early Prolog implementations were bootstrapped using Fortran:
Blockquote
From June to the end of the year [1973], Gérard Battani, Henri Meloni, and Rent Bazzoli, postgraduate students at the time, wrote the interpreter in FORTRAN and its supervisor in Prolog
Some of the very early Lisp environments were implement in ancient dialects of Fortran:
Blockquote
This paper concentrates on the development of the basic ideas of LISP and distinguishes two periods - Summer 1956 through Summer 1958 when most of the key ideas were developed (some of which were implemented in the FORTRAN based FLPL), and Fall 1958 through 1962 when the programming language was implemented and applied to problems of artificial intelligence. After 1962, the development of LISP became multi-stranded, and different ideas were pursued in different places.
Slightly related, I see this as my ideal computing environment, with Fortran, C, or C++ being used for performance critical areas.
Blockquote
A mixed-system architecture is developed, in which Fortran and Prolog are each used to best advantage, and which allows discrete events to be combined with pseudo-continuous processes. The architecture is analysed in terms of a number of performance metrics. The paper concludes that the mixed architecture is feasible, practicable and brings a variety of benefits.
GitHub - ktye/i: interpret has implementations of K in various languages, including Fortran 77. It’s a single file without comments and many INTEGER*4 and REAL*8 declarations that does compile with gfortran and produces an interpreter that ran a few K commands I tried. Compiling the source with Intel Fortran gives
k.f(16888): error #6404: This name does not have a type, and must have an explicit type. [FGET]
S = FGET(C)
----------^
compilation aborted for k.f (code 1)
The fget() function/subroutine is not specified by the fortran standard. Here is a link that describes the gfortran fget() intrinsic. Its history traces back to the earlier g77 and f2c compilers.
Here is a link that describes the intel implementation, which involves a module.