Remix.run Logo
palad1n 9 hours ago

I think the legend goes Wirth created the Pascal language to be the most easily compilable. To show my age, I recall a class used Modula-2 when I was in college, also from Wirth, very Pascal-like.

pjmlp 8 hours ago | parent | next [-]

Nowadays you can enjoy it on GCC, as it is now an officially supported frontend, after GNU Modula-2 got merged into it.

https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gm2

Even available on compiler explorer to play with, https://godbolt.org/z/ev9Pbxn9K

Yes, that was a common trend across all programming languages designed by him.

That is also how P-Code came to be, he didn't want to create a VM for Pascal, rather the goal was to make porting easier, by requiring only a basic P-Code interpreter, it was very easy to port Pascal, a design approach he kept for Modula-2 (M-Code) and Oberon (Slim binaries).

vincent-manis 16 minutes ago | parent [-]

With all due respect to Wirth, P-Code did not originate in a vacuum. Martin Richards's BCPL compiler, dating from the late 1960s, targeted a hypothetical OCode machine. Furthermore, although there were backends for this that generated good machine code on popular computers of the time, Richards also had a backend that generated a severely reduced instruction set, which he called Intcode. You could write an assembler and interpreter for Intcode in a few hundred lines of Fortran (I did), which meant you could have a slow BCPL implementation on a new machine in a day or so's work, and then you could write a better backend in BCPL.

I have never been able to determine whether Wirth knew of this work, but, given that Richards's 1969 BCPL paper described OCode, I suspect he was aware of it, and that it influenced his design of the Pascal-P compiler. (I am not sure when Intcode appeared, but it was present when I obtained the BCPL compiler in 1972, a year before the Pascal-P release.)

tristramb 4 hours ago | parent | prev | next [-]

I seem to remember (but I can't find the source) that Wirth initially had three aims in designing Pascal:

1. To use it in teaching a structure programming course to new students. As in the late 60's all student programming was batch mode (submit your program to an operator to run, and pick up the printout the following day), this meant the compiler had to be single-pass and give good error messages.

2. To use it in teaching a data structures course involving new data structures worked out by Wirth and Hoare.

3. To use it in teaching a compilers course. This meant the compiler code had to be clean and understandable. Being single-pass helped in this.

zabzonk 9 hours ago | parent | prev [-]

> most easily compilable

I think it was more that it would be easy to write a compiler for, which meant that CS students could write one. Don't have a source for this that I can remember, though.