On Wed, 4 Jan 2012, Vintage Coder wrote:
I actually thought of trying to write a compiler in
modern FORTRAN since
I seem to be too old to learn anything new, but the F90 and later
language is so wierd and ugly (good grief, lower case and indentation?!
Sacrilege!) I decided against it.
<rant>
F90 and even Fortran77 are nice languages for some people,
BUT THEY AIN'T FORTRAN !
I thought I had read one of the early IBM FORTRAN
compilers was written
in FORTRAN but the G & H compilers appear to be in assembler like all
the other OS/360 stuff.
It used to be that EVERY CS grad student wrote a new language, as a rite
of passage. I don't know whether that was required by the university, or
just social pressure.
One of the "requirements" was that the final version of it must have been
written in it and compiled BY IT. (Obviously earlier versions must have
used assemblers and/or compilers of other languages)
While it seems like a nice "proof" of the language, it very clearly shows
a lack of understanding that if the new language was not intended for, and
designed as, a compiler authoring tool, that that would certainly NOT be
the best choice for creation of the final product.
Of course, many schools (UC Berkeley) DON'T CARE about that, and teach
that if the only problems are speed and size performance, that the
correct solution is throw hardware at them!
"If you want to sort an array larger than 64K, then GET MORE RAM."
"If it's too slow, then use a faster computer." (also used by OS tech
support with, "I'm amazed that it can even RUN on such obsolete [1 year
old], inadequate [Are YOU inadequate?] hardware! Try something more
current!")
Note: I made my Data Structures and Algorithms students write a MERGE
program to combine two already sorted files. I've heard UC grads insist
that the CORRECT way to write it is to append the two files, load the
result into memory, and use a Shell Metzner sort. [How many things are
wrong with THAT?]
C is pretty good for writing compilers, and it takes little more than "The
dragon book" (Aho & Ullman) plus a LOT of time and effort to produce one.
C is best at systems programming, particularly due to how easy it is to
shove it out of your way if you need to get closer to the hardware, but
C is often MISUSED for writing general purpose and even business programs,
for which it can be spectacularly inappropriate.
FORTRAN is well suited for many things, including a lot of different kinds
of scientific programming, but is NOT a good choice for writing compilers.
Maybe F90 might be better, to use INSTEAD OF FORTRAN.
PASCAL is a good rigorous INTERMEDIATE (not first exposure) teaching
language. It's usable, but not great, for compiler writing. For example,
see the runtime library used in the early Microsoft compilers,
particularly their FORTRAN compiler (where simple benchmarks, such as a
"Sieve of Erastothanes" run slower than interpreted BASIC)
What is SCHEME best suited for? (An answer of "EVERYTHING" will destroy
your credibility.)
Does anybody write compilers in assembly any more? Or ever will, again?
</rant>
--
Grumpy Ol' Fred cisin at
xenosoft.com