Subject: [bug#78481] [PATCH V2] Support for the Algol 68 language

From: "Jose E. Marchesi" <[email-masked]>
Date: Sun, 18 May 2025 17:21:02 +0200

[Adding in CC:
 - Iain Buclaw, the D front-end maintainer for GCC.
 - Arthur Cohen, the Rust front-end maintainer for GCC.,
 - James K. Lowden and Robert Dubner, the COBOL front-end maintainers
   for GCC.]

Hi Bruno.

> In <https://lists.gnu.org/archive/html/autoconf-patches/2025-04/msg00000.html>
> Paul Eggert renamed the variable A68 → A68C, with the rationale:
>   "Use the shell variable A68C, not A68,
>    for the compiler.  This is for consistency of names compared to
>    support for other languages like Go."
>
> In <https://lists.gnu.org/archive/html/autoconf-patches/2025-05/msg00000.html>
> José Marchesi renamed the variable A68FLAGS → A68CFLAGS, with the rationale:
>   "as mandated by the GCS"
>
> The result of these renamings makes no sense to me:
>
>   1) The GNU Algol 68 compiler is meant to be named 'ga68', not 'ga68c'. [1]
>      The prefix 'g' is specific for the GNU implementation; it's normal
>      to ignore it here, when we talk about conventions that should encompass
>      non-GNU implementations as well.

Some other GCC compilers use 'gcc' as a prefix, which I think could also
be considered "specific for the GNU implementation".  If so, we would
have:

  gcc      CC
  g++      CXX
  gdc      DC
  ga68     A68
  gcobol   COBOL
  gm2      M2
  objc     OBJC
  gccrs    RS
  gccgo    GO

>   2) The GCS [2] has examples where the variable name is the program name,
>      uppercased.
>
>   3) As a result, users would be looking for a command 'a68c', but there is
>      no such command.

Yes I agree, that is bad.

> I'm bringing this up because a similar case will be with the GNU Modula-2
> compiler, when we want to support it in Autoconf and Automake.
>
>   * The GNU Modula-2 compiler is called 'gm2'. Therefore it will be natural
>     (per GCS [2]) to call the variables M2 and M2FLAGS.
>
>   * Calling the variable M2C would be very very confusing, because there is
>     a Modula-2 to C translator called 'm2c' [3][4][5] and, unlike gm2, it
>     produces C code, not an executable.
>
> And the big picture should also consider the GNU D compiler, when we want
> to support it in Autoconf and Automake.
>
>   * The GNU D compiler is called 'gdc'. Therefore, and because a 1-letter
>     variable 'D' would be really odd, it makes sense to called the program
>     variable 'DC'.
>
>   * Whether the flags variable is then called DFLAGS (for consistency with
>     CFLAGS) or DCFLAGS (per GCS [2]), can be debated.
>
> I think part of the problem comes from looking at the Go support.
>
>   * Go is different than Algol 68 and Modula-2. The reference implementation
>     ('go') and the GNU implementation ('gccgo') are multi-purpose programs.
>     To compile a program, one uses
>       $ go build foo.go
>       or
>       $ gccgo build foo.go
>     To compile and run a program, one uses
>       $ go run foo.go
>       or
>       $ gccgo run foo.go
>
>   * The AC_PROG_GO macro [6] sets variables GOC and GOFLAGS. Which already
>     violates the letter of the GCS [2].
>
> Since the AC_PROG_GO macro already violates the letter of the GCS [2] and is
> instead following the rule "The compiler options for programming language X
> is in variable XFLAGS", it is hard to reach both goals at the same time:
>   (I) Following the letter of the GCS [2],
>   (II) Consistency with the existing language support in Autoconf.
>
> I can see two reasonable ways of naming the variables; the current proposal
> from José is, unfortunately, not among them:

It actually was, initially ^^

> Proposal A: Define (I) as the more important goal.
>
>   GO            GOFLAGS
>
>   A68           A68FLAGS
>
>   M2            M2FLAGS
>
>   DC            DCFLAGS
>
>   This implies changing AC_PROG_GO so that it defines the GO variable, and
>   deprecating the GOC variable.
>
> Proposal B: Define (II) as the more important goal.
>
>   GOC           GOFLAGS
>
>   A68 or A68C   A68FLAGS
>
>   M2            M2FLAGS
>
>   DC            DFLAGS
>
>   Here (II) is nearly fulfilled, except that we cannot use M2C as variable,
>   as explained above. So, goal (II) is not entirely reached. Instead, the
>   *FLAGS variable depends on the programming language, not on the compiler
>   command. Goal (I) cannot be reached either, but it's a reasonable compromise
>   nevertheless.

For Algol 68 I always preferred A68/A68FLAGS to A68C/A68CFLAGS, and it
matches both proposals A and B.

So if the Autoconf and Automake maintainers agree to use Proposal A or
Proposal B, I will happily submit patches to change it in Automake and
update the Autoconf patch to reflect it.  Fortunately the Algol 68
support in Automake hasn't been released yet, so there is still time to
correct this.