7 ms·
Great news! Curious - are there any selfhosting Fortran compilers?
by beezle 8y ago
Great news! Curious - are there any selfhosting Fortran compilers?
- TimTheTinker 8y agoIf 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?
- pjmlp 8y agoAs the very first high level language, plenty of compilers were implemented in FORTRAN during the 60's.
- rbanffy 8y agoI'm not sure people used HLLs to write compilers at that time.
- pjmlp 8y agoYou 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.
- rbanffy 8y agoThat's true. Not only compilers, but a lot of MCP was written in Algol.
- bluGill 8y agoI'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.
- yiyus 8y agoFortran 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.
- sampo 8y ago> 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?
- dmitryminkovsky 8y agoI’m guessing your parent comment is thinking along the lines of https://news.ycombinator.com/item?id=14123100 https://news.ycombinator.com/item?id=14123100
- jeyemhex 8y agoFrom 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).
- e12e 8y agoI'm not sure that makes much sense;forth is typically a thin layer over a machine (historically physical, but also a VM, like the jvm) - so it'd generally make sense to implement the "compiler" is "assembler" (whatever that means for a given "machine")? A forth in forth that is a cross compiler or something, doesn't quite "feel" like a forth system? See also: https://www.forth.com/starting-forth/11-forth-compiler-defining-words/ https://www.forth.com/starting-forth/11-forth-compiler-defin...
- alexhutcheson 8y agoThe article is about Fortran, not Forth.
- e12e 8y agoOh, thank you for pointing that out. Not sure how I missed that :) Ed: now I'm kinda excited about an llvm forth...