8 ms·
GCC SC approves inclusion of Algol 68 Front End
- zik 10mo agoAs a fan of Algol 68, I'm pretty excited for this. For people who aren't familiar with the language, pretty much all modern languages are descended from Algol 60 or Algol 68. C descends from Algol 60, so pretty much every popular modern language derives from Algol in some way [1]. [1] https://ballingt.com/assets/prog_lang_poster.png https://ballingt.com/assets/prog_lang_poster.png
- dhosek 10mo agoFinally.
- nine_k 10mo agoIf PL/I was like a C++ of the time, Algol-68 was probably comparable to a Scala of the time. A number of mind-boggling ideas (for the time), complexity, an array of kitchen sinks.
- int_19h 10mo agoIt certainly has quite a reputation, but I suspect it has more to do with dense formalism that was quite unlike everything else. The language itself is actually surprisingly nice for its time, very orthogonal and composable.
- j2kun 10mo ago> I'm pretty excited for this Aside from historical interest, why are you excited for it?
- zik 10mo agoI've actually been toying with writing an Algol 68 compiler myself for a while. While I doubt I'll do any major development in it, I'll definitely have a play with it, just to revisit old memories and remind myself of its many innovations.
- ofalkaed 10mo agoPersonally, I think the whole C tangent was a misstep and would love to see Algo 68 turn into Algo 26 or 27. I sort of like C and C++ and many other languages which came, but they have issues. I think Algo 68 could develop into something better than C++, it has some of the pieces already in place. Admittedly, every language I really enjoy and get along with is one of those languages that produced little compared to the likes of C (APL, Tcl/Tk, Forth), and as a hobbyist I have no real stake in the game.
- inkyoto 10mo agoWhilst I think that C has its place, my personal choice of Algol 26 or 27 would be CLU – a highly influential, yet little known and underrated Algol inspired language. CLU is also very approachable and pretty compact.
- uecker 10mo agoI wonder about what you think is wrong with C? C is essentially a much simplified subset of ALGOL68. So what is missing in C?
- pjmlp 10mo agoProper strings and arrays for starters, instead of being pointers that the programmer is responsible for doing length housekeeping.
- uecker 10mo agoArrays are not pointers and if you do not let them decay to one, they do preserve the length information.
- pjmlp 10mo agoThey surely behave like one as soon as they leave local scope. Kind of hard when passing them around as funcion parameters, and the static trick doesn't really work in a portable way. Lets seen how far WG14 gets with cybersecurity laws with this kind of answers being analysed by SecDevOps and Infosec experts.
- Taniwha 10mo agoI would argue C comes from Algol68 (structs, unions, pointers, a full type system etc, no call by name) rather than Algol60
- inkyoto 10mo agoThat is indeed correct. Kernighan in his original book on C cited Algol 68 as a major influence.
- adrian_b 10mo agoC had 3 major sources, B (derived from BCPL, which had been derived from CPL, which had been derived from ALGOL 60), IBM PL/I and ALGOL 68. Structs come from PL/I, not from ALGOL 68, together with the postfix operators "." and "->". The term "pointer" also comes from PL/I, the corresponding term in ALGOL 68 was "reference". The prefix operator "*" is a mistake peculiar to C, acknowledged later by the C language designers, it should have been a postfix operator, like in Euler and Pascal. Examples of things that come from ALGOL 68 are unions (unfortunately C unions lack most useful features of the ALGOL 68 unions. which are implicitly tagged unions) and the combined operation-assignment operators, e.g. "+=" or "*=". The Bourne shell scripting language, inherited by ksh, bash, zsh etc., also has many features taken from ALGOL 68. The explicit "malloc" and "free" also come from PL/I. ALGOL 68 is normally implemented with a garbage collector.
- themafia 10mo ago> it should have been a postfix operator, like in Euler and Pascal. I never liked Pascal style Pointer^. As the postfix starts to get visually cumbersome with more than one layer of Indirection^^. Especially when combined with other postfix Operators^^.AndMethods. Or even just Operator^ := Assignment. I also think it's the natural inverse of the "address-of" prefix operator. So we have "take the address of this value" and "look through the address to retreive the value."
- adrian_b 10mo agoThe "natural inverse" relationship between "address-of" and indirect addressing is only partial. You can apply the "*" operator as many times you want, but applying "address-of" twice is meaningless. Moreover, in complex expressions it is common to mix the indirection operator with array indexing and with structure member selection, and all these 3 postfix operators can appear an unlimited number of times in an expression. Writing such addressing expressions in C is extremely cumbersome, because they require a great number of parentheses levels and it is still difficult to see which is the order in which they are applied. With a postfix indirection operator no parentheses are needed and all addressing operators are executed in the order in which they are written. So it is beyond reasonable doubt that a prefix "*" is a mistake. The only reason why they have chosen "*" as prefix in C, which they later regretted, was because it seemed easier to define the expressions "*++p" and "*p++" to have the desired order of evaluation. There is no other use case where a prefix "*" simplifies anything and for the postfix and prefix increment and decrement it would have been possible to find other ways to avoid parentheses and even if they were used with parentheses that would still have been simpler than when you have to mix "*" with array indexing and with structure member selection. Moreover, the use of "++" and "--" with pointers was only a workaround for a dumb compiler, which could not determine by itself whether it should access an array using indices or pointers. Normally there should be no need to expose such an implementation detail in a high-level language, the compiler should choose the addressing modes that are optimal for the target CPU, not the programmer. On some CPUs, including the Intel/AMD CPUs, accessing arrays by incrementing pointers, like in the old C programs, is usually worse than accessing the arrays through indices (because on such CPUs the loop counter can be reused as an index register, regardless of the order in which the array is accessed, including for accessing multiple arrays, avoiding the use of extra registers and reducing the number of executed instructions). With a postfix "*", the operator "->" would have been superfluous. It has been added to C only to avoid some of the most frequent cases when a prefix "*" leads to ugly syntax.
- somat 10mo agoYes, massively influential, but was it ever used or popular?, I always think of it as sort of the poster child for the danger of "design by committee". Sure it's ideas spawned many of today's languages, But wasn't that because at the time nobody could afford to actually implement the spec. So we ended up with a ton of "algols buts" (like algol but can actually be implemented and runs on real hardware).
- dboreham 10mo agoUsed extensively on Burroughs mainframes.
- Taniwha 10mo agoBurroughs used an Algol60 derivative (not '68)
- pjmlp 10mo agoESPOL initially, which evolved into NEWP.
- Taniwha 10mo agoESPOL was (is?) simply a version of the standard Algol compiler that let you do 'system' sorts of things. The Burroughs large systems architecture didn't really protect you from yourself, system security/integrity depended on only letting code from vetted compilers run (only a compiler could make a code file, and only a privileged person could make a program a compiler) - so the Algol 60 compiler made code that was safe, Espol could make code that wasn't, could do things a normal user couldn't - you kept the espol compiler somewhere safe away from the students .... (there was a well known hole in this whole thing involving mag tapes)
- pjmlp 10mo agoAs mentioned it evolved into NEWP, and you can get all the manuals from Unisys, as they keep selling it. Given its architecture, it is sold for batch processing systems where security is paramount. Yes, ESPOL and NEWP, being one of the first systems languages with UNSAFE code blocks, a binary that is compiled having unsafe is tainted and requires administrator configuration before being allowed to execute by the system. One cannot just compile such code and execute it right away.
- Onavo 10mo agoThey can just fork off the Golang frontend and it would be the same, maybe patch the runtime a bit.
- MangoToupe 10mo agoDoes gcc even support go?
- ameliaquining 10mo agoYes, though language support runs behind the main Go compiler. https://go.dev/doc/install/gccgo https://go.dev/doc/install/gccgo
- wahern 10mo agoUntil a few years ago, gccgo was well maintained and trailed the main Go compiler by 1 or 2 releases, depending on how the release schedules aligned. Having a second compiler was considered an important feature. Currently, the latest supported Go version is 1.18, but without Generics support. I don't know if it's a coincidence, but porting Generics to gccgo may have been a hurdle that broke the cadence.
- ratmice 10mo agoSeems doubtful, given that generics and the gccgo compiler were both spearheaded by Ian Lance Taylor, it seems more likely to me that him leaving google would be a more likely suspect, but I don't track go.
- pjmlp 10mo agoThis has been stagnant long before he left.
- syockit 10mo agoThe best thing about gccgo is that it is not burdened with the weirdness of golang's calling convention, so the FFI overhead is basically the same as calling an extern function from C/C++. Take a look at [0] and see how bad golang's cgo calling latency compare to C. gccgo is not listed there but from my own testing it's the same as C/C++. [0]: https://github.com/dyu/ffi-overhead https://github.com/dyu/ffi-overhead
- MangoToupe 10mo agoWhere might one look to find examples of such code? I've never found algol outside of wikipedia
- deleted 10mo ago[deleted]
- geocar 10mo agohttps://rosettacode.org/wiki/Category:ALGOL_68 https://rosettacode.org/wiki/Category:ALGOL_68 https://github.com/search?q=algol68&type=repositories https://github.com/search?q=algol68&type=repositories Without knowing what your interests/motivations and backgrounds are, it is hard to make good recommendations, but if you didn't know about rosettacode or github I figured I should start with that
- MangoToupe 10mo agoWhat I'm taking away from this is that there's absolutely zero code of interest that is Algol 68
- geocar 10mo agoInterests vary! Just because you can’t find something interesting doesn’t mean it isn’t interesting. That lesson once learned pays dividends
- pjmlp 10mo agoOld papers and computer manuals from the 1960's. Many have been digitalized throughout the years across Bitsavers, ACM/SIGPLAN, IEEE, or university departments. Also heavily influenced languages like ESPOL, NEWP, PL/I and its variants.
- jemarch 10mo agoYou can find some modern Algol 68 code, using the modern stropping which is the default in GCC, at https://git.sr.ht/~jemarch/godcc https://git.sr.ht/~jemarch/godcc Godcc is a command-line interface for Compiler Explorer written in Algol 68.
- ConanRus 10mo ago[dead]
- pesasuenoX 10mo ago[flagged]
- NooneAtAll3 10mo agoany algol tutorial recommendations? just to feel what's it all about
- jemarch 10mo agoI would recommend the Informal Introduction to Algol 68, available in PDF at https://algol68-lang.org/resources https://algol68-lang.org/resources
- lanstin 10mo agoWow that is cool. Pass by name. I always wanted to try it.
- Y_Y 10mo agoJust pass a string and `eval` it.
- Taniwha 10mo agoAlgol60 had call by name, Algol68 doesn't really, it does have "proceduring" which creates a function to call when you pass an expression to a parameter that's a function pointer that has no parameters, you can use that to sort of do something like call by name but the expense is more obvious
- 0xpgm 10mo agoIn my mind this highlights something I've been thinking about, the differences between FOSS influenced by corporate needs vs FOSS driven by the hacker community. FOSS driven by hackers is about increasing and maintaining support (old and new hardware, languages etc..) while FOSS influenced by corporate needs is about standardizing around 'blessed' platforms like is happening in Linux distributions with adoption of Rust (architectures unsupported by Rust lose support).
- gldrk 10mo agoThe big difference is that Algol 68 is set in stone. This is what allows a single dedicated person to write the initial code and for it to keep working essentially forever with only minor changes. The Rust frontend will inevitably become obsolete without active development. Algol 68 isn’t any more useful than obsolete Rust, however.
- jemarch 10mo agoThe core Algol 68 language is indeed set in stone. But we are carefully adding many GNU extensions to the language, as was explicitly allowed by the Revised Report: [RR page 52] "[...] a superlanguage of ALGOL 68 might be defined by additions to the syntax, semantics or standard-prelude, so as to improve efficiency or to permit the solution of problems not readily amenable to ALGOL 68." The resulting language, which we call GNU Algol 68, is a strict super-language of Algol 68. You can find the extensions currently implemented by GCC listed at https://algol68-lang.org/ https://algol68-lang.org/
- dfawcus 10mo agoI had a small programming task a while ago, and decided to try doing it algol68 (using the algol68 genie interpreter) simply because I'd had some exposure to the language many years ago at Uni. It was an AWK like task, but I decided up front it was too much trouble to do in AWK, as I needed to build a graph of data structures from the input data. In part the program had an AWK like pattern matching and processing section, which wasn't too awkward. I found having to use REF's more trouble that dealing with pointers, in part due to the forms of auto dereferencing the language uses; but that was expected. The real problem though was that I ended up needing something like a map / hash-table, and I concluded it was too much trouble to write from scratch. So in the end I switched the program to be written in Go. That then suggests a few things to me: - it should have an extension library (prelude) offering some form of hash table. - it would be useful to add syntax for explicit pointers (PTR keyword) which are not automatically dereferenced when used. - maybe have with either something like the Go (or Zig) style syntax for selecting a member of a pointed to struct (a.b) and maybe Zig like explicit defer (ptr.\*). That latter pointer suggestions because I found the "field OF struct" form too verbose, and especially confusing when juggling REFs which may or may not get auto dereferenced.
- pjmlp 10mo agoI find this great, finally an easy way to play with ALGOL 68, beyond the few systems that made use of it, like the UK Navy project at the time. Ironically, Algol 68 and Modula-2 are getting more contributions than Go, on GCC frontends, which seems stuck in version 1.18, in a situation similar to gcj. Either way, today is for Algol's celebration.
- LeFantome 10mo agoThis makes me worry for the GCC implementation of Rust. People do not seem to use or upkeep the GCC versions of languages who primary Open Source implementations are elsewhere.
- pjmlp 10mo agoThere is the advantage that GCC will be only way for Rust to be available in some targets where LLVM isn't an option. Regarding Go, gccgo was a way to have a better compiler backend for those that care about optimizations that reference Go compiler isn't capable of, due to the difference in history, philosophy, whatever. Apparently that effort isn't seen as worthwile by the community.
- InfamousRece 10mo agoWill it compile Knuth’s test? https://en.wikipedia.org/wiki/Man_or_boy_test https://en.wikipedia.org/wiki/Man_or_boy_test
- chuckadams 10mo agoThat test is short enough to just paste it in here: begin real procedure A(k, x1, x2, x3, x4, x5); value k; integer k; real x1, x2, x3, x4, x5; begin real procedure B; begin k := k - 1; B := A := A(k, B, x1, x2, x3, x4) end; if k ≤ 0 then A := x4 + x5 else B end; outreal(1, A(10, 1, -1, -1, 1, 0)) end The whole "return by assigning to the function name" is one of my least favorite features of Pascal, which I suppose got it from Algol 60. Where I'm confused though is, what is the initial value of B in the call to A(k, B, x1, x2, x3, x4)? I'm guessing the pass-by-name semantics are coming into play, but I still can't figure out how to untie this knot.
- svat 10mo agoYeah that's one of the things the test was designed to catch: at that point, B is a reference, to the B that is being defined. Here's a C++ translation from https://oeis.org/A132343 https://oeis.org/A132343 that uses identity functions to make the types consistent: #include <functional> #include <iostream> using cf = std::function<int()>; int A(int k, cf x1, cf x2, cf x3, cf x4, cf x5) { int Aval; cf B = [&]() { int Bval; --k; Bval = Aval = A(k, B, x1, x2, x3, x4); return Bval; }; if (k <= 0) Aval = x4() + x5(); else B(); return Aval; } cf I(int n) { return [=](){ return n; }; } int main() { for (int n=0; n<10; ++n) std::cout << A(n, I(1), I(-1), I(-1), I(1), I(0)) << ", "; std::cout << std::endl; } So in the expression `A(k, B, x1, x2, x3, x4)`, the `B` there is not called, it simply refers to the local variable `B` (inside the function `A`), that was captured by the lambda (by reference): the same B variable that is currently being assigned.
- chuckadams 10mo ago
- adsl731898322 10mo agoThis is great news for GCC! I love how this decision supports older languages like Algol 68, keeping them alive in the FOSS world. It shows the hacker community's dedication to preserving diverse tools.
- LeFantome 10mo agoIt is awesome. That said, it really stands out to me that the two latest GCC languages are Cobol and Algol68 while LLVM gets Swift and Zig. And Rust and Julia come from LLVM as well of course.
- LeFantome 10mo agoDoes GNU Algol 68 use a garbage collector?
- dribblecup 10mo agoALGO 68 (dc) was the go to language for Burrough's [6-8]x00 variants. These were fairly popular for awhile and supported advanced features like multiprocessing. The demand for exercising the full range of capabilities was kind of niche but an "amateur", like myself, could make a few bucks if you knew ALGOL. I used to have the grey manual for the Burrough's variant - I'll have to poke around to see if it's in the attic somewhere.
- gnufx 10mo agoNot relevant to GCC, but one use for an old A68 compiler was apparently to be adapted for the old NA Software Fortran 90 compiler, I was told by a former colleague. I'd have expected Ada to be a closer fit, and I don't know how well the decision worked out.
- firesteelrain 10mo agoGCC Gnat frontend is used for modern Ada development these days. Not sure if that’s what you mean