JvanKatwijk / algol-60-compiler

an algol 60 to C translator (old stuff but fun project)
GNU General Public License v2.0
35 stars 7 forks source link

not stropped #9

Closed gtoal closed 1 year ago

gtoal commented 2 years ago

I had posted about the examples not using stropped keywords but I've just found in the source that stropping is indeed available as an option so I've deleted the issue. Sorry about that. But I'll just leave this as a chance to say hello, I've done some work in a similar area and there's not many of us around still interested in old 60's code!

Regards, Graham

JvanKatwijk commented 2 years ago

The first character in the input file determines whether or not we use "stropped" or "unstropped" keywords

Op vr 6 mei 2022 om 22:15 schreef Graham Toal @.***>:

I know this is a fallow project but just in case you ever pick it up again, I feel I should point out that, as with the Marst translator, the input sources to this in all your examples are not Algol 60. Algol 60 used stropped keywords, not reserved words. Any Algol program where variables used the same names as keywords would fail with this style of parser. You should accept the standard stropping conventions and have a line reconstruction phase that maps keywords to something unprintable, eg by adding 128 to the characters in keywords, or canonicalising keywords to lower case and variables to upper case, while removing spaces etc. There's a few examples of original algol sources in the TESTS subdirectory at https://www.gtoal.com/languages/algol60/ Regards, Graham

— Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/algol-60-compiler/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQDLGN2ZPKM45AAKZW3VIV4XJANCNFSM5VJEXKQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jan van Katwijk

JvanKatwijk commented 2 years ago

'begin' 'integer' 'procedure' try (n); 'value' n; 'integer' n; 'begin' 'integer' 'array' ploc [1 : n]; 'comment' for i := 1 step 1 until n do ploc [i] := 1; try := 2 * n; 'end' try;

'integer' k, n; n := 50; outinteger (1, n); k := try (n); outinteger (1, k); outstring (1, "ok\n"); 'end'

works fine.

Of course one could debate whether or not the keywords should be in capitals or not. As far as I remember the terminals I used in the late 60-ies (ASR33) there were only capitals, but for the english keywords I have chosen tje lowercase ones, fits better in current times

Op za 7 mei 2022 om 17:41 schreef jan van katwijk @.***>:

The first character in the input file determines whether or not we use "stropped" or "unstropped" keywords

Op vr 6 mei 2022 om 22:15 schreef Graham Toal @.***>:

I know this is a fallow project but just in case you ever pick it up again, I feel I should point out that, as with the Marst translator, the input sources to this in all your examples are not Algol 60. Algol 60 used stropped keywords, not reserved words. Any Algol program where variables used the same names as keywords would fail with this style of parser. You should accept the standard stropping conventions and have a line reconstruction phase that maps keywords to something unprintable, eg by adding 128 to the characters in keywords, or canonicalising keywords to lower case and variables to upper case, while removing spaces etc. There's a few examples of original algol sources in the TESTS subdirectory at https://www.gtoal.com/languages/algol60/ Regards, Graham

— Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/algol-60-compiler/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQDLGN2ZPKM45AAKZW3VIV4XJANCNFSM5VJEXKQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jan van Katwijk

-- Jan van Katwijk

gtoal commented 2 years ago

Ah, I see you saw the original version of my comment before I deleted it! Actually the choice of stropping with upper case or lower case keywords was sometimes enabled with a line in the source deck - In Atlas Autocode, which was developed around the same time as Algol 60 and had a lot in common, there were both "UPPER CASE DELIMITERS" and "normal delimiters" commands which enabled that style of stropping. By default, however, Atlas Autocode used a percent symbol to strop (eg "%integer %fn sqrt(%real num)") which in Algol 60 would have usually been represented as 'integer' 'fn' sqrt('real' num). Some Algol 60 implementations only used an opening quote in a similar style to to AA's '%' stropping, ie 'integer 'fn sqrt('real num) and one Algol 60 implementation for the KDF9 actually used the same '%' stropping as Atlas Autocode (probably the compilers were written by the same person/team - they may both have been based on the Compiler-Compiler) - this is the example I found: https://www.gtoal.com/languages/algol60/KDF9/soap.a60 Coral66 was another language that used Algol-style stropping. I'm more familiar with Imp, which is the language I'm currently writing a transpiler to C for. Imp is derived from Atlas Autocode, but is also similar to Algol60, in fact at Edinburgh they had both Imp and Algol 60 compilers and they both shared a common runtime library. You mentioned an ASR33 and the influence the I/O hardware had on these languages - Atlas Autocode was developed at a site that used Friden Flexowriters, and the original definition of Atlas Autocode actually used underlining to strop keywords. A few of the language symbols also relied on overstriking at the time, although substitute characters were introduced later.

Anyway the point of this ramble is to suggest that a possible way to handle multiple stropping choices is by having an independent pre-pass to filter the different syntaxes and output a canonical standard form that the parser can read without any processing needed. For example, "integerfnSQRT(realNUM)" with non-significant newlines, spaces and comments etc removed. By the way, since you are Dutch, did you ever had any contact with the folks at Groeningen University? - one of the few places outside the UK that used Imp - due to connections with people from Edinburgh, they wrote an operating system in the language: GUTS (Groeningen University Time Sharing system - https://history.dcs.ed.ac.uk/archive/scans/guts/ ).

Best regards,

Graham

JvanKatwijk commented 2 years ago

Hi Graham

There is not much demand for Algol 60 compilers today (prpbably no surprise). I wrote the code 20 years ago, at that time I had a management position and would do something more interesting. In the '70-ties I had written an Algol compiler on (for) the PDP-11 with its memory constraint, mainly used by students if they want to avoid the waiting times for the processing of their programs on the central computer of the computer centre The basic idea was just to generate a large tree and do all processing in a few twee walks, and to generate (more or less) readable C code, all just for fun.

Then, a few years ago, I discivered that I till had the sources somewhere and with one or two mods it ran and I put it on github. I got a few comments from some people who were actually using the compiler for running old stuff.

As far as I know, there are some people in France and Switserland that use the compiler and report on the use (and occasionally point out a bug),

At TU Delft we did not have much contact with Groningen, and in the CS department we hardly had contacts with out own computer centre, Due to the budgeting policy of the university, CS was not considered very important, Civil engineering,, electrical engineering, that were things to be proud on as university.

My own interest shifted from languages and compilers in the 70-ties and early 80-ties to software modeling, to a certain extent engineering and a little to more formal aspects of design and implementation.

I myself git involved in management in the early 90-ties and kept doing that until retiring. After retiring I got more interest in software defined radio (as a schoolboy I built radios with nice glowing tubes)

Anyway, Algol 60 is history. It is interesting to see that some people are ujsing the compiler for bringing (numerical) history to life, and I will gladly supporrt the use of the compiler for those purposes

Best jan

Op zo 8 mei 2022 om 06:41 schreef Graham Toal @.***>:

Ah, I see you saw the original version of my comment before I deleted it! Actually the choice of stropping with upper case or lower case keywords was sometimes enabled with a line in the source deck - In Atlas Autocode, which was developed around the same time as Algol 60 and had a lot in common, there were both "UPPER CASE DELIMITERS" and "normal delimiters" commands which enabled that style of stropping. By default, however, Atlas Autocode used a percent symbol to strop (eg "%integer %fn sqrt(%real num)") which in Algol 60 would have usually been represented as 'integer' 'fn' sqrt('real' num). Some Algol 60 implementations only used an opening quote in a similar style to to AA's '%' stropping, ie 'integer 'fn sqrt('real num) and one Algol 60 implementation for the KDF9 actually used the same '%' stropping as Atlas Autocode (probably the compilers were written by the same person/team - they may both have been based on the Compiler-Compiler) - this is the example I found: https://www.gtoal.com/languages/algol60/KDF9/soap.a60 Coral66 was another language that used Algol-style stropping. I'm more familiar with Imp, which is the language I'm currently writing a transpiler to C for. Imp is derived from Atlas Autocode, but is also similar to Algol60, in fact at Edinburgh they had both Imp and Algol 60 compilers and they both shared a common runtime library. You mentioned an ASR33 and the influence the I/O hardware had on these languages - Atlas Autocode was developed at a site that used Friden Flexowriters, and the original definition of Atlas Autocode actually used underlining to strop keywords. A few of the language symbols also relied on overstriking at the time, although substitute characters were introduced later.

Anyway the point of this ramble is to suggest that a possible way to handle multiple stropping choices is by having an independent pre-pass to filter the different syntaxes and output a canonical standard form that the parser can read without any processing needed. For example, "integerfnSQRT(realNUM)" with non-significant newlines, spaces and comments etc removed. By the way, since you are Dutch, did you ever had any contact with the folks at Groeningen University? - one of the few places outside the UK that used Imp - due to connections with people from Edinburgh, they wrote an operating system in the language: GUTS (Groeningen University Time Sharing system - https://history.dcs.ed.ac.uk/archive/scans/guts/ ).

Best regards,

Graham

— Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/algol-60-compiler/issues/9#issuecomment-1120348929, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQD4G6R6CYEVL5AOQIDVI5AWHANCNFSM5VJEXKQA . You are receiving this because you commented.Message ID: @.***>

-- Jan van Katwijk

rocus commented 2 years ago

I vaguely remember IMP. In the70ties we (in Groningen) used an Algol60 compiler on a CDC (control data corporation) computer. I remember a professor by the name of Whitfield and I think he came from Edinburg. Later came an Algol 68 compiler on the CDC Cyber (a 6 pass compiler!) but that never got hold. Nice to see some old Algol programming! (call by name/call by value!)

gtoal commented 2 years ago

I vaguely remember IMP. In the70ties we (in Groningen) used an Algol60 compiler on a CDC (control data corporation) computer. I remember a professor by the name of Whitfield and I think he came from Edinburg. Later came an Algol 68 compiler on the CDC Cyber (a 6 pass compiler!) but that never got hold. Nice to see some old Algol programming! (call by name/call by value!)

Yes, Harry Whitfield! He's the professor I mentioned who taught the Operating Systems class at Groningen which developed the GUTS system. He's still around. (this is his web site: http://g6auc.me.uk/ellipses/index.html ) If you remember GUTS, have a look at the pdfs in this directory: https://gtoal.com/history.dcs.ed.ac.uk/archive/scans/guts/ (And if you have saved machine readable source code of GUTS please let me know!!!)

To avoid hijacking this thread completely, here's some previously-unseen Algol 60 documentation from Edinburgh that may be of interest to Jan: https://gtoal.com/history.dcs.ed.ac.uk/archive/staging-area/JHB/ercc,%20emap,%20emas/Edinburgh%20Algol%20Language%20Manual%20(checked).pdf - interesting to note that Edinburgh's Algol60 used the '%keyword' style of stropping!

JvanKatwijk commented 2 years ago

Thanks for the manual, it brings back memories of the 70-ies and 80-ies. Around 79 most student s of TU Delft did an introductory course in programming using Algol 60. Prior to app '79 punchcards were used, in 79 a PDP-11/70 was acquired and equipped with (too many) terminals . Students could edit their program ans send it to the 370 that ran the Algol compiler using a reasonably fast link. I forgot the name of the link, but the PDP - with 1 Mbyte - ran a Unix version, as far as I remember a local variant of PWB unix.

I let some students run their program on my Algol load and go compiler on the PDP-11, but the compiler was essentially a product for testing my parser generator and experimenting with error recovery in LR based parsers. The compiler, a load-and-go compiler was essentially my first C program, large parts were recoded from a BCPL version I was playing with before we got Unix and C. The parser generator used was written in BCPL. Since the compiler was one pass, there were some limitations but it could handle the type of programs used tby the students then.

The compiler here, i.e. the "jff-algol" compiler was written in a time that I was "full time faculty management" (following the MUB TU Delft opted for single person faculty board), so essentially I was full time busy with meetings and writing "important" strategy documents. In a summer period - some 20 years ago - I wanted to do some programming and at first I looked at the Ada compiler I had written in the 80-ies, but too many sources were lost. I decided to do a project that could be done in a couple of weeks and I wrote this compiler. Other than the one from the 70-ies there were no memory constraints so the compiler builds a large parse tree in memory and makes a few tree walks to check static semantics and do the code generation.

To my surprise the sources - that were saved on floppy discs - when recovered a few years back, compiled with only one or two mods as did the run time environment. Based on a question I put everytthing on github and I got lots of positive comments

best jan

Op za 20 aug. 2022 om 21:39 schreef Graham Toal @.***>:

I vaguely remember IMP. In the70ties we (in Groningen) used an Algol60 compiler on a CDC (control data corporation) computer. I remember a professor by the name of Whitfield and I think he came from Edinburg. Later came an Algol 68 compiler on the CDC Cyber (a 6 pass compiler!) but that never got hold. Nice to see some old Algol programming! (call by name/call by value!)

Yes, Harry Whitfield! He's the professor I mentioned who taught the Operating Systems class at Groningen which developed the GUTS system. He's still around. (this is his web site: http://g6auc.me.uk/ellipses/index.html ) If you remember GUTS, have a look at the pdfs in this directory: https://gtoal.com/history.dcs.ed.ac.uk/archive/scans/guts/ (And if you have saved machine readable source code of GUTS please let me know!!!)

To avoid hijacking this thread completely, here's some previously-unseen Algol 60 documentation from Edinburgh that may be of interest to Jan: https://gtoal.com/history.dcs.ed.ac.uk/archive/staging-area/JHB/ercc,%20emap,%20emas/Edinburgh%20Algol%20Language%20Manual%20(checked).pdf

— Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/algol-60-compiler/issues/9#issuecomment-1221394238, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQD4N63RGRDE5JEUZFLV2EYAVANCNFSM5VJEXKQA . You are receiving this because you commented.Message ID: @.***>

-- Jan van Katwijk

gtoal commented 1 year ago

Hoi Jan,

I've not been idle on the Algol 60 front since last we talked - I took on a project to recover some source code from a PDF scan (the Statal package) and in doing so tried my best to represent the source code in as close a form as I could to the original publication syntax, which I was able to do using Unicode characters. One thing led to another and eventually I threw together a new parser to read in Algol 60 programs... Why a new parser, I hear you ask... because I wanted to read the source directly in Unicode format without first using some utility to transliterate into an 8bit ascii format. It's still a bit of a work-in-progress, but I thought as one of the few people still around who is interested in Algol parsers, you might enjoy trying it out: https://gtoal.com/languages/algol60/new-unicode-parser/ - there's a tar file there (just untar it, and 'make') and if you scroll down that web directory a bit, there's some attempt at initial documentation (of which any feedback to improve it would be welcome).

Groetjes,

Graham

gtoal commented 1 year ago

here's some previously-unseen Algol 60 documentation from Edinburgh that may be of interest to Jan: https://gtoal.com/history.dcs.ed.ac.uk/archive/staging-area/JHB/ercc,%20emap,%20emas/Edinburgh%20Algol%20Language%20Manual%20(checked).pdf - interesting to note that Edinburgh's Algol60 used the '%keyword' style of stropping!

If the above manual was of interest - I've rekeyed it with the partial help of some OCR, at https://gtoal.com/history.dcs.ed.ac.uk/archive/languages/algol60/Edinburgh_ALGOL_Language_Manual.html - feel free to cut & paste if there's anything there that might add to your own Algol's documentation.