Hacker News new | ask | show | jobs
by Zickzack 1375 days ago
As always, the off topic invitation cannot be passed.

The two-level grammar of Algol 68 gave the semantics of Algol 68 in a denotational language, the second level. As such, it is not more complicated as other languages with defined semantics, such as in the ML family. To my knowledge, people used that second level to implement a real virtual (ho hum) machine, resulting in a working interpreter. However, the ML aficionados can be surprised with the information that their language was not first one with fully defined semantics. Algol 68 was ahead of its time.

As for Pascal, history as I know says that Wirth invented Pascal as a training language for a course in which a one pass compiler was to be built. Only later, when the Algol 68 project became complicated, Wirth started to market it as a superior design - something which it never has been.

And yes, I enjoyed Turbo Pascal.

1 comments

Is there a source on Van Vijngaarden grammars that’s even barely readable to the modern eye (and more detailed than Wikipedia)? I tried a number of contemporary papers, and they’re impressively impenetrable when they try to define the whole thing inside a page and a half—which is entirely unsurprising even if you set aside the prehistoric terminology (“notions” are ... nonterminals? or maybe all symbols? I can’t tell).

In any case, there’s something to be said for defining a language in a series of layers: tokens, then trees, then perhaps elaboration / desugaring, then one or more layers of semantics (typing, binding, execution). In an actual frontend, you probably even want a looser tree syntax followed by a layer of “semantic” checks that could technically be folded into the syntax, in order to be able to tell the user things like “you can’t use an array type like that” rather than “unexpected bracket”. Compare Lisp s-expressions, the Dylan idea of skeleton syntax trees, and the class of visibly pushdown languages as used in one recent structural editor[1]. Contrast the refusal of the Glasgow Haskell Compiler to desugar before typechecking[2].

[1] https://news.ycombinator.com/item?id=31384528

[2] https://www.aosabook.org/en/ghc.html

I learned Algol 68 by studying the Revised Report on Algol 68, which was published in 1977 as an edition of ACM SIGPLAN (Special Interest Group on Programming Languages) Notices. The publication can be downloaded for free from the ACM website, see [1]. The first author is Van Vijngaarden.

Page 6 of the report presents the ideas of the Vw-grammar. Protonotions, Notions, Metanotions, Hypernotions, Paranotions, Symbols, Productions and Production Trees are introduced to explain the grammar! I encourage readers to take a peek at almost any paragraph of the 70 page Algol 68 report and compare it to the The Programming Language Pascal Revised Report by Wirth [2],[3]. It's easy to see why Pascal became quite popular and Algol 68 never did.

Despite the fact that Algol 68 was too difficult to compile efficiently at the time, it introduced a number of features we take for granted today. See Richard Hamlet's Ignorance of Algol 68 Considered Harmful, [4].

On a personal note, I was a young Computer Scientist at the time these reports were published, and I miss how easy it was back then to keep up with the research that was going on at the time. Today it's impossible to be a generalist. So many independent and important branches have sprouted off the trunk of CS that everyone is a novice in major parts of the field.

[1] ACM SIGPLAN Notices, Volume 12, Issue 5, May 1977 pp 1–70, https://doi.org/10.1145/954652.1781176

[2] http://standardpascaline.org/The_Programming_Language_Pascal...

[3] https://www.amazon.com/Pascal-User-Manual-Report-Standard/dp...

[4] ACM SIGPLAN Notices, Volume 12, Issue 4, April 1977 pp 51-56, https://doi.org/10.1145/954654.954659

Is the "Learning Algol 68 Genie 3.0" guide [1] of some help?

[1] https://jmvdveer.home.xs4all.nl/en.download.learning-algol-6...

First off, thank you for finally getting me to read that, it’s been sitting around in my to-read list since forever (2017? but the version is 2.0 from 2010? a long time ago, anyway).

Second... OK, I got through the first part (the language description), and it basically confirms my earlier brief glances at various Algol 68 documents: it’s a fundamentally pretty nice and consistent language with some warts, some hilariously archaic points, and godawful one-of-a-kind terminology, and its age excuses basically all of those. (No surprise I liked it though, I like both Standard ML and METAFONT, and those are both transparently Algolish in different ways.) Not looking forward to the ALLCAPS operators, but then I wrote some all-caps Forth some time ago and it was okay.

Third, though—that description (unlike the report) doesn’t seem to be using W-grammars at all? It uses what is pretty pedestrian ABNF in funny notation. It’s very helpful in getting me to understand how Algol 68 works, but doesn’t really relate to my original question of how those two-level W-things work. Except by maybe reverse engineering them by comparing the report with the guide, but that sounds like a last-resort option.