From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id dfd664a8 for ; Wed, 8 Jan 2020 05:23:26 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 7E13E9BCAE; Wed, 8 Jan 2020 15:23:25 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 524499BCAB; Wed, 8 Jan 2020 15:23:04 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id B19C59BCAB; Wed, 8 Jan 2020 15:23:02 +1000 (AEST) Received: from cuzuco.com (v.cuzuco.com [166.84.7.17]) by minnie.tuhs.org (Postfix) with ESMTP id B62AE9BCA9 for ; Wed, 8 Jan 2020 15:23:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by cuzuco.com (8.14.9/8.13.3) with SMTP id 0085KdTi008574; Wed, 8 Jan 2020 00:20:50 -0500 (EST) Date: Wed, 8 Jan 2020 00:20:39 -0500 (EST) Message-Id: <202001080520.0085KdTi008574@cuzuco.com> From: Brian Walden To: Subject: Re: [TUHS] # (was Re: sh: cmd | >file) X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Dave Horsfall wrote: >On Tue, 7 Jan 2020, Bakul Shah wrote: > >> In Algol68 # ... # is one of the forms for block comments! > >Interesting... All we had at university though was ALGOL W (as far as I >know; there were several languages that mere students could not use, such >as FORTRAN H). Yes, but when was it implemented? Kernighan is first ever if it is not before 1974. So I decided to look and it took me down a rabbit hole of ALGOL taht leads back to Bourne shell and then right back to # (but in C) By reading the ALGOL 68 wiki page, the laguange seemed to have had a character set problem since day one, and it seems if you didn't have the cent-sign you were to use PR for pragmat for comments. And since it had problems it was continually extened. I just cant find when # was defined. I looked at various old implementations (none pre 1974 list #) -- - CDC's ALGOL 68 compiler from 1975 you could only use use PR .. PR (both # and CO were not defined) http://www.bitsavers.org/pdf/cdc/Tom_Hunter_Scans/Algol_68_version_1_Reference_Manual_RevB.pdf - The official revised ALGOL86 spec from 1978 lists all these ways to enter them (bottom of page 112) in this order -- brief comment symbol: cent-sign bold comment symbol: comment style 1 comment symbol: co style 2 comment symbol: # bold pragmat symbol: pragmat style 1 pragmat symbol: pr seeing # is "style 2" it looks like a later extention to me http://www.softwarepreservation.org/projects/ALGOL/report/Algol68_revised_report-AB.pdf - ALGOL68/19 from 1975 list these 4 symbols as comments: # % co pr http://www.softwarepreservation.org/projects/ALGOL/manual/Gennart_Louis-Algol_ 68_19_Reference_Manual.pdf - DECs ALGOL (1976 printing but first released was 1971) for system10 uses a ! for a comment as # means "not equal" -- http://www.bitsavers.org/www.computer.museum.uq.edu.au/pdf/DEC-10-LALMA-B-D%20 decsystem10%20ALGOL%20Programmer's%20Reference%20Manual.pdf - CMU's ALGOL68S from 1978 list all these ways -- co comment comment comment pr pragmat pragmat pragmat # (comment symbol) comment :: (pragmat symbol) pragmat (its for UNIX v6 or v7 so not surprising # is a comment) http://www.softwarepreservation.org/projects/ALGOL/manual/a68s.txt/view - Rutgers ALGOL 68 interprter from 1987 for UNIX does not implement PR nor PRAMAT and says comments are # CO or COMMENT https://www.renyi.hu/~csirmaz/algol-68/linux/manual I could not find a freely accessible manual for ALGOL68R (very 1st one) nor Cambridge's ALGOL68C. What's intresting here is Stephen Bourne was on the team that made ALGOL68C before he move to Bell Labs. It'd be pretty funny if he implemented a language that there were 7 or 8 ways to enter a comment (cent, co, comment, pr, pragmat, #, ::, %) yet there were zero ways to enter a comment in the Bourne shell. Also the style of "COMMENT put a note here COMMENT" is very un-ALGOL like (with DO .. OD, IF .. FI) shouldn't it be like this? COMMENT put a note here TNEMMOC CO put a note here OC PRAGMAT directive here TAMGARP PR directive here RP So then I remembered Bourne used the C preprocssor to make C like ALGOL when he wrote the shell. If you've never seen it, his C looks like this -- case TSW: BEGIN REG STRING r = mactrim(t->swarg); t=t->swlst; WHILE t DO ARGPTR rex=t->regptr; WHILE rex DO REG STRING s; IF gmatch(r,s=macro(rex->argval)) ORF (trim(s), eq(r,s)) THEN execute(t->regcom,0); t=0; break; ELSE rex=rex->argnxt; FI OD IF t THEN t=t->regnxt FI OD END break; ENDSW So I wanted to see if he remapped C comments /* */ I am not even sure you could even do that with the C preprocessor but took alook anywy and in https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/xec.c It's first lines are this -- # /* * UNIX shell * * S. R. Bourne * Bell Telephone Laboratories * */ #include "defs.h" #include "sym.h" So nope, just regular C comments (which came from PL/I btw which was what multics was programmed in) But look! The very first line of that file! It is a single # sitting all by itself. Why? you ask. Well this is a hold over from when the C preprocessor was new. C orginally did not have it and was added later. PL/I had a %INCLUDE so Ritchie eventaully made a #include -- but pre 7th Edition the C preprocessor would not be inkoved unless the very first character of the C source file was an # Since v7 the preprocessor always run on it. The first C preprocessor was Ritchie's work with no nested includes and no macros. v7's was by John Reiser which added those parts. that 1st line with a single # sitting by itself reminds me of the csh construct as well. -Brian