Page 1 of 1

What is the strangest language that you can write an OS in?

Posted: Mon Dec 12, 2022 3:28 am
by stjepanbm
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.

Re: What is the strangest language that you can write an OS

Posted: Thu Dec 29, 2022 2:49 pm
by Octocontrabass
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.

Re: What is the strangest language that you can write an OS

Posted: Thu Dec 29, 2022 4:01 pm
by BigBuda
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.
Huh... ChatGPT anyone?

Re: What is the strangest language that you can write an OS

Posted: Fri Dec 30, 2022 12:44 am
by iansjack
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.

Re: What is the strangest language that you can write an OS

Posted: Sat Dec 31, 2022 12:44 pm
by Schol-R-LEA
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.

Re: What is the strangest language that you can write an OS

Posted: Sun Jan 01, 2023 2:06 am
by Schol-R-LEA
Ohh, this one is interesting - for some very odd values of 'interesting'. House: An Operating System in Haskell.

Re: What is the strangest language that you can write an OS

Posted: Tue Jan 03, 2023 12:27 pm
by Schol-R-LEA
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.

Re: What is the strangest language that you can write an OS

Posted: Thu Jan 19, 2023 3:12 pm
by AndrewAPrice
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.

Re: What is the strangest language that you can write an OS

Posted: Fri Jan 20, 2023 11:27 am
by eekee
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.
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).
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.

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. :D 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. :D

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? :lol:

Re: What is the strangest language that you can write an OS

Posted: Fri Jan 20, 2023 6:11 pm
by eekee
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&.