> Even while Pascal wasn't written with low-level programming in mind
If that’s true, then neither was C, Algol, etc. When those languages were conceived, “low-level” programming was just “programming” and “high-level programming” was the exception. Mostly because the hardware ecosystem was far more fragmented and an OS wasn’t guaranteed.
To that effect, all of those languages give you the “features” necessary to “low-level” program, namely: raw pointers and ability to compile for freestanding environments.
Hi, author of Jacqueline here. I read HN almost daily so it caught me off guard to see my stuff here.
It's been a long time since I did this (2019). It was a prototype just to see if a standard PC boot loader could hand-off into something that's not C (or Rust). And yes you can, as long as the programming language has a way to control how symbol names are exported, and then to link the object code with the rest of the boot loader.
You won't have a runtime unless you implement one, so for most languages there is no stdlib, no exception handling, no garbage collector... But it is fun anyway. As I said, this was a prototype and once it could say Hello World I considered it complete.
Happy to see it here though, and I'll be happy to answer any questions about what I remember, or what is like to write code in Pascal, or OS development or i386 in general.
I remember writing my own bootloader for my DOS-successor OS project with its own FS when I was 17. Never got around other than running a primitive kernel that just displayed text on the screen though. Fun times! https://gist.github.com/ssg/546634
i386 is a great target for toy OSs. There's no risk of getting a bit megalomaniacal and thinking your OS could ever be anything more than a toy. Also, it's more challenging than RISC-V, ARM, and even x86-64, so it feels like more of an accomplishment if you actually make it to userland and back without catastrophic failures.
Mac OS 9 was written in Pascal, and so was the Berkeley P-System, a portable Pascal development environment from the 1970s, featuring a virtual machine that influenced the later JVM. Apple's Lisa OS was also implemented in Pascal.
Indeed, e.g. Apple Lisa OS and the first Mac OS. But the present one so far is only around 100 lines; the author calls it a "bootloader". Here is a list of more complete systems: https://wiki.freepascal.org/Operating_Systems_written_in_FPC.
How come? Pascal is a perfectly good language, it wouldn't be my first choice for anything but compared to quite a few other languages from that era it got lots of things right.
There have always been fanboy "camps" feuding each other, from "What's the best programming language?" to the never-ending "What's the best text editor?".
Brian Kernighan tried to port his famous software tools (the code to go with the likewise famous book) to Pascal and failed, which led to a write-up, in which he identified 9 shortcomings of Pascal that C doesn't have.
https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pas...
But needless to say, there exist also many strenghs of Pascal over C, which he does not address. I find his claim that Pascal is only a toy language in which serious software can be written unprofessional and empirically untrue: for over a decade, PC software development in Pascal was thriving thanks to TurboPascal. Now admittedly that is not standard ISO Pascal, but at the same time, it is a well-known fact that it existed, and that it fixed some of the criticisms of Kernighan's paper, so it is regrettable he still elected to use such strongly negative language regardless. (And for the record, his paper was written 1981, when Pascal's successor Modula-2 was already available.)
I like C and Pascal, each in their own way, but Pascal is
arguably much more readable, and perhaps it is fair to say many Pascal programmers were comfortable in the language and would not have bothered to learn/struggle with C.
> Even while Pascal wasn't written with low-level programming in mind
If that’s true, then neither was C, Algol, etc. When those languages were conceived, “low-level” programming was just “programming” and “high-level programming” was the exception. Mostly because the hardware ecosystem was far more fragmented and an OS wasn’t guaranteed.
To that effect, all of those languages give you the “features” necessary to “low-level” program, namely: raw pointers and ability to compile for freestanding environments.
Hi, author of Jacqueline here. I read HN almost daily so it caught me off guard to see my stuff here.
It's been a long time since I did this (2019). It was a prototype just to see if a standard PC boot loader could hand-off into something that's not C (or Rust). And yes you can, as long as the programming language has a way to control how symbol names are exported, and then to link the object code with the rest of the boot loader.
You won't have a runtime unless you implement one, so for most languages there is no stdlib, no exception handling, no garbage collector... But it is fun anyway. As I said, this was a prototype and once it could say Hello World I considered it complete.
Happy to see it here though, and I'll be happy to answer any questions about what I remember, or what is like to write code in Pascal, or OS development or i386 in general.
I remember writing my own bootloader for my DOS-successor OS project with its own FS when I was 17. Never got around other than running a primitive kernel that just displayed text on the screen though. Fun times! https://gist.github.com/ssg/546634
Thats the pascal kernel in all its glory. Its just a bare metal hello world
KernelMain(); [public name 'kernelMain']; begin consoleClearDisplay(); consoleSetAttributes(White, Black); consolePutString('Hello world'); end;
Love it
> Jacqueline is an experimental bootloader written in Pascal (Free Pascal dialect) written for the i386 architecture, just because
i386 is a great target for toy OSs. There's no risk of getting a bit megalomaniacal and thinking your OS could ever be anything more than a toy. Also, it's more challenging than RISC-V, ARM, and even x86-64, so it feels like more of an accomplishment if you actually make it to userland and back without catastrophic failures.
"doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386" -Linux Torvalds, 1991
Finally an OS I can really get behind.
Remember kids, there were a few 1980's OSes that made use of Pascal.
Nice to see yet another experiment that isn't always C or C++.
Mac OS 9 was written in Pascal, and so was the Berkeley P-System, a portable Pascal development environment from the 1970s, featuring a virtual machine that influenced the later JVM. Apple's Lisa OS was also implemented in Pascal.
Indeed, e.g. Apple Lisa OS and the first Mac OS. But the present one so far is only around 100 lines; the author calls it a "bootloader". Here is a list of more complete systems: https://wiki.freepascal.org/Operating_Systems_written_in_FPC.
Pascal? The author must hate himself.
How come? Pascal is a perfectly good language, it wouldn't be my first choice for anything but compared to quite a few other languages from that era it got lots of things right.
There have always been fanboy "camps" feuding each other, from "What's the best programming language?" to the never-ending "What's the best text editor?".
Brian Kernighan tried to port his famous software tools (the code to go with the likewise famous book) to Pascal and failed, which led to a write-up, in which he identified 9 shortcomings of Pascal that C doesn't have. https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pas...
But needless to say, there exist also many strenghs of Pascal over C, which he does not address. I find his claim that Pascal is only a toy language in which serious software can be written unprofessional and empirically untrue: for over a decade, PC software development in Pascal was thriving thanks to TurboPascal. Now admittedly that is not standard ISO Pascal, but at the same time, it is a well-known fact that it existed, and that it fixed some of the criticisms of Kernighan's paper, so it is regrettable he still elected to use such strongly negative language regardless. (And for the record, his paper was written 1981, when Pascal's successor Modula-2 was already available.)
I like C and Pascal, each in their own way, but Pascal is arguably much more readable, and perhaps it is fair to say many Pascal programmers were comfortable in the language and would not have bothered to learn/struggle with C.