Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If a Fortran compiler were self-hosting, I might think twice before using it... I can't imagine implementing a parser/lexer in Fortran of all languages. Considering that loops and procedures are the main supported models of indirection/abstraction, I expect the defect rate per kLoC would be rather high.

Edit: Looks like OOP support arrived in Fortran 2003. Does anyone know how much of a difference it made?



As the very first high level language, plenty of compilers were implemented in FORTRAN during the 60's.


I'm not sure people used HLLs to write compilers at that time.


You just need to search for papers, quite a few available.

In fact, during the 60's Algol variants were already being used to write compilers and OSes.


That's true. Not only compilers, but a lot of MCP was written in Algol.


I'm sure they did. I'd even expect most compilers were written in a HLL. Note that most refers to quantity: I expect most compilers were written as an academic exercise with no real intent to be used in production. I would expect the compilers that were intended for people to use to write production code were written in assembler because at the time compiler optimizations where not very good; computers were slow and expensive; and programmers were cheap: as such it would be worth the extra cost to write your compiler in a low level language.


Fortran has evolved a lot. You can practically use any programming paradigm with it. If you chose well a subset of all its features, you can actually write quite elegant code. I have never used it for this and do not have any example, but I would not expect it to be particularly worse than any other language.


> Considering that loops and procedures are the main supported models of indirection/abstraction

What does this mean, and how is this any different from e.g. C?


I’m guessing your parent comment is thinking along the lines of https://news.ycombinator.com/item?id=14123100


From the use-cases I've seen, OOP didn't make a massive difference. Many of the ideas from OOP were possible before, e.g. abstraction with modules and derived types (essentially C structs) from Fortran 90/95. Others, like polymorphism felt a bit bolted on and haven't gained widespread usage.

As for a self-hosting compiler, I'm not aware of one, although it's something I'd be interested in having a go at. I've written a regex engine in Fortran before, I just haven't had the time to sit down with the Fortran standard and a textbook on compiler design (I'm a physicist by trait, so I've not been taught this stuff formally).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: