3 ms·
There are some books at my university about how to program on PL/1. So, I've wanted to write some code with it out of sheer curiosity for some time (especially
by trealira 1y ago
There are some books at my university about how to program on PL/1. So, I've wanted to write some code with it out of sheer curiosity for some time (especially given a lot of the "interesting features" I've heard about that modern languages don't all have). I only lacked a compiler to use. Thanks for finding one, OP.
- palmotea 1y ago> (especially given a lot of the "interesting features" I've heard about that modern languages don't all have) Such as?
- pjmlp 1y agoBounds checking in strings and arrays in a well known systems language, 10 years younger. :)
- trealira 1y agoI remember reading this link that went through them, but the link is dead now: https://minnie.tuhs.org/pipermail/tuhs/2021-November/024695.html https://minnie.tuhs.org/pipermail/tuhs/2021-November/024695.... But a couple interesting things I remember hearing (though I'm not sure if they were in the linked page) were passing alternate return address labels to functions, and resumable exceptions (although Lisp and Ruby do have this). Also, not that unique, but that no keywords are reserved, and so you can have variables named "if" and such.
- jll29 1y agoI also wrote a language in which keywords are not reserved, called Leazy, during high school ( https://github.com/jochenleidner/leazy https://github.com/jochenleidner/leazy ), but just for fun. It`s arguably a good idea to treat keywords as reserved, in order to avoid confusion and to write faster compilers. No-one should (be able to) write confusing code like: if if = then then then = else else else = end end if It's good to have a PL/1 compiler available to those that hwve legacy needs and that want to learn about the language, but it has been said it was overly complex (what I read about it sound like it was "the C++ of its time"). Since then, many language designers, at least the good ones (e.g. Wirth, Gosling), have recognized that less is more.
- trealira 1y agoThanks for sharing your old compiler and the source code listing for it, though I can't read the documentation in German. Out of curiosity, how did you deal with the fact that for a top-down parser, 1 token of lookahead isn't enough to know if, say, you're dealing with an if-statement (e.g. "if x > 0 then ...") or an assignment or procedure call using a variable named "if" (e.g. "if = 1", "if(x, y, z)")? I feel like the best solution would be an LR parser that reduced to an if statement only when seeing "if <expr> then" (and I saw you mentioned LALR and LL parsers somehow in your documentation), but you could also maybe use a backtracking top down parser. I realize could read the source code listing, but I think it would be easier just to ask, and I might misunderstand it.
- dfawcus 1y agoWould that be this, using the current version of the TUHS archive? https://www.tuhs.org/pipermail/tuhs/2021-November/024695.html https://www.tuhs.org/pipermail/tuhs/2021-November/024695.htm...
- trealira 1y agoYes, that's it, thanks. I knew the site wasn't dead, so I was confused why the link seemingly was.
- adrian_b 1y agoThe language PL/I included in its specification many things that are omitted in most modern languages, being implemented in libraries or in the operating system, e.g. for handling threads (tasks in IBM lingo), exceptions, signals, events. However the integration in the language of those features made them frequently more convenient and I consider the pthreads API available in UNIX/Linux as considerably inferior to the thread handling that PL/I already had in 1965 (e.g. already then PL/I had an equivalent of WaitForMultipleEvents that was better than anything in pthreads). Even if the C language has evolved from BCPL, most of its evolution has consisted in taking various features either from PL/I or from Algol 68. The C language has introduced very few innovations, i.e. only the "continue" statement and its more general (but more verbose and cumbersome) syntax for the "for" statement. Therefore many features of C and of its descendants come from PL/I, e.g. "struct", ".", "->", "malloc" and "free", signals and many others. Also PL/I allowed aggregates, i.e. arrays and structures, in many contexts where most modern languages accept only scalar variables, requiring verbose loops for handling aggregates (or the definition of custom object classes, i.e. the implementation of some library for handling them).
- pjmlp 1y agoAnd removed two big ones, bounds checkings and proper arrays.