What is the strangest language that you can write an OS in?
- stjepanbm
- Posts: 2
- Joined: Mon Dec 12, 2022 3:19 am
- Libera.chat IRC: stjepanbm
- Location: Split, Croatia
What is the strangest language that you can write an OS in?
So I have been wondering, what is the strangest language you can write an operating system in?
And by strangest I mean a programming language not normally used in OS Dev.
And by strangest I mean a programming language not normally used in OS Dev.
Anything written in assembly will always be faster than C.
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: What is the strangest language that you can write an OS
There are some OS projects written in C#, and that always struck me as a strange choice. It does seem to work pretty well, though.
The strangest language nobody's written an OS in yet (that I know of) is probably the Plain English programming language.
The strangest language nobody's written an OS in yet (that I know of) is probably the Plain English programming language.
Re: What is the strangest language that you can write an OS
Huh... ChatGPT anyone?Octocontrabass wrote:There are some OS projects written in C#, and that always struck me as a strange choice. It does seem to work pretty well, though.
The strangest language nobody's written an OS in yet (that I know of) is probably the Plain English programming language.
Writing a bootloader in under 15 minutes: https://www.youtube.com/watch?v=0E0FKjvTA0M
Re: What is the strangest language that you can write an OS
Lisp and Smalltalk have both been used to write operating systems, but I doubt many people are using them for that purpose today. Similarly, Oberon - though I doubt that many people write anything with it today. All 3 were originally used on hardware designed specifically for them.
There are a host of assembly languages that would fit the bill.
There are a host of assembly languages that would fit the bill.
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: What is the strangest language that you can write an OS
JavaOS probably doesn't count for this list, as it was in fact one of the language design goals to use it as a systems language for embedded systems. Ada has been used in a number of OS projects, but again, it was meant as a systems language from the outset, so it isn't particularly unusual. Similarly with FORTH, which while a definite stand-out in uniqueness, was specifically designed for systems and embedded programming (it was initially used for controlling radio telescopes). The same applies to BCPL (an ancestor of C, and the systems language which was used in TripOS, which was later re-written in C to create AmigaDOS) and PL/M (which was developed specifically for writing CP/M in). I mention these five mainly to rule them out as examples of what @stjepanbm appears to have in mind, because I figured someone might mention them, even if they aren't as well known today (or aren't usually thought of as systems languages, as in the case of Java).
Aside from the various Lisp Machines back in the 1980s, there's Mezzano, an ongoing project which uses Common Lisp as its primary systems language.
My own plans also call for a Lisp family language, but one of my own design, which I am working on (or more often, failing to work on) at this time. A few others here have, or are planning on, designing their own languages for systems work.
I ought to mention UCSD Pascal from the mid-1970s and early 1980s, a mostly-portable OS which used a p-code interpreter as a lower-level OS underneath the Pascal code, and added several notable extensions to Standard Pascal. It was moderately popular in the late 1970s as an alternative to CP/M, and saw some use in industrial and research systems. It was actually intended to be one of the four operating system options for the IBM PC, but it never got any traction on that platform.
We've had at least one person claiming that they were going to write an OS in PHP, but they seem to have gone quiet shortly afterwards, presumably after they'd been informed of the problems inherent in accomplishing that. Similarly with plans for using JavaScript as a systems language, something which has come up more than once. IIRC, at least one of these cases involved a conflation of a GUI with an OS.
Python comes up here from time to time, and at least one such project made at least a little progress I think.
Aside from the various Lisp Machines back in the 1980s, there's Mezzano, an ongoing project which uses Common Lisp as its primary systems language.
My own plans also call for a Lisp family language, but one of my own design, which I am working on (or more often, failing to work on) at this time. A few others here have, or are planning on, designing their own languages for systems work.
I ought to mention UCSD Pascal from the mid-1970s and early 1980s, a mostly-portable OS which used a p-code interpreter as a lower-level OS underneath the Pascal code, and added several notable extensions to Standard Pascal. It was moderately popular in the late 1970s as an alternative to CP/M, and saw some use in industrial and research systems. It was actually intended to be one of the four operating system options for the IBM PC, but it never got any traction on that platform.
We've had at least one person claiming that they were going to write an OS in PHP, but they seem to have gone quiet shortly afterwards, presumably after they'd been informed of the problems inherent in accomplishing that. Similarly with plans for using JavaScript as a systems language, something which has come up more than once. IIRC, at least one of these cases involved a conflation of a GUI with an OS.
Python comes up here from time to time, and at least one such project made at least a little progress I think.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: What is the strangest language that you can write an OS
Ohh, this one is interesting - for some very odd values of 'interesting'. House: An Operating System in Haskell.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: What is the strangest language that you can write an OS
While it is clearly intended as a joke, I just ran across an esolang and 'complete computer operating system and program development environment' called Petrovich, which is based on genetic programming by way of Pavlovian conditioning. Basically, the idea is that the computer would be told to take some random action, then either 'rewarded' or 'punished' depending on the outcome. Presumably, this would eventually lead the program to do whatever the programmer intended it to do.
Despite the claim of being an OS, it doesn't seem to be intended as one, and indeed the original 'designer' never implemented the idea. Someone else did, in Java, but not as a standalone OS. Still, the claim was made of ir being an OS, so I'm going to count it.
Despite the claim of being an OS, it doesn't seem to be intended as one, and indeed the original 'designer' never implemented the idea. Someone else did, in Java, but not as a standalone OS. Still, the claim was made of ir being an OS, so I'm going to count it.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: What is the strangest language that you can write an OS
JavaScript without a VM? In theory you could write a JIT compiler. Although properties and dynamic typing might generate a lot of slow boilerplate code if it can't infer the type at compile time.
My OS is Perception.
Re: What is the strangest language that you can write an OS
APL has run native if I'm not mistaken, and is an odd language by most programmers' definitions. I suppose much of the system would have been written in assembly language, but there's always a point where features may just as well be coded in the high-level language.
The inventor of Forth later quit the language and wrote a GUI OS directly in machine code. Then he did it again, this time with no GUI but a very strange implementation of Forth for scripting. All the text was Shannon-coded, and there was something about the coded definition names themselves being the code. Anyway, this Forth is known as colorForth, but the OSs are OKaD and OKaD2.
Where's @DavidCooper? He's written an OS in machine code too, and he prefers decimal to hex.
But the real answer to the OP's question would be an OS written in an esolang. Unfortunately, searching the Esolang Wiki only turns up a thought experiment. Someone ought to just go ahead and do it. I have had thoughts of doing it myself, using one of those languages in which the program exists on a 2D grid and choices are made as conditional turns left or right. I have enough trouble getting on with a more normal project, though.
LOL! The Esolang Wiki has a page on Forth. Of course it does.
I have also considered daydreamed about an OS implemented as a spreadsheet. I mean, a spreadsheet is basically a functional programming language, so why not?
Yeah. Forth looks very strange, but it's a good match for many low-end architectures of the 70s 80s & 90s. The abundance of registers in newer designs might seem to obsolete it, but the registers can be used with some fairly simple optimizations. That said, it is a strange langauge to work with if you try to use it as its inventor intended: with very small definitions and without local variables. Large definitions can be impossible to debug. Local variables are very difficult to fit into a traditional, Forth system. The best I've seen put the local variables on a 3rd stack, requiring redundant memory copies where Forth otherwise requires less memory copies than a pass-by-value language.Schol-R-LEA wrote:Similarly with FORTH, which while a definite stand-out in uniqueness, was specifically designed for systems and embedded programming (it was initially used for controlling radio telescopes).
The inventor of Forth later quit the language and wrote a GUI OS directly in machine code. Then he did it again, this time with no GUI but a very strange implementation of Forth for scripting. All the text was Shannon-coded, and there was something about the coded definition names themselves being the code. Anyway, this Forth is known as colorForth, but the OSs are OKaD and OKaD2.
Where's @DavidCooper? He's written an OS in machine code too, and he prefers decimal to hex.
But the real answer to the OP's question would be an OS written in an esolang. Unfortunately, searching the Esolang Wiki only turns up a thought experiment. Someone ought to just go ahead and do it. I have had thoughts of doing it myself, using one of those languages in which the program exists on a 2D grid and choices are made as conditional turns left or right. I have enough trouble getting on with a more normal project, though.
LOL! The Esolang Wiki has a page on Forth. Of course it does.
I have also considered daydreamed about an OS implemented as a spreadsheet. I mean, a spreadsheet is basically a functional programming language, so why not?
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Re: What is the strangest language that you can write an OS
Please excuse me doubleposting, but I just discovered @wxwisiasdf has written a kernel in COBOL. That's pretty out there! It's only a proof of concept, but still...
I started writing up a bit about OSs in FreeBASIC, but then I realised there are so many of them, it can't be called a strange choice of language any more. (Example: @trolly's microkernel-based GUI OS.) It is a bit strange for a BASIC, requiring type declarations like C (but more verbose). I suppose it makes it more suitable for systems programming than the QuickBasic it once imitated, while still being more readable than$ more% traditional# BASICs&.
I started writing up a bit about OSs in FreeBASIC, but then I realised there are so many of them, it can't be called a strange choice of language any more. (Example: @trolly's microkernel-based GUI OS.) It is a bit strange for a BASIC, requiring type declarations like C (but more verbose). I suppose it makes it more suitable for systems programming than the QuickBasic it once imitated, while still being more readable than$ more% traditional# BASICs&.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie