allocate, deallocate, etc. vs. contains, extends, etc.
Why?
a-/de-allocate is a command, so grammatically it would be imperative
contains/extends just states a fact, thus indicative
Maybe this is related to the grammar (computer and English), but keywords like allocate, deallocate, open, close
, and do
are all things that occur at run time. Keywords like contains
and extends
control how the source code is organized and how data types are defined, things done at compile time. Was this done by design, or is it just a coincidence?
I first wondered about compiler grammar many years ago when we got a machine with a French Algol compiler. Before it arrived we wondered if it would want us to say COMMENCE or COMMENCEZ instead of BEGIN. But the machine had to be treated more impersonally; the word was COMMENCER.
I did not know that such varieties of programming languages were available. They were, and here is an example.
BOUCLE : EPS1 :=T1 ; NITER :=0 ;
SI A[N-2]=0 ALORS DEBUT
SI (ABS(S)+ABS(P)=0) ALORS DEBUT
S:=0.1 ; P:=0.2 ; FIN FIN ;
ITER : NITER :=NITER+1 ;
SI NITER > MAXITER ALORS DEBUT
EPS1:=10*EPS1 ;
SI EPS1 > EPS2 ALORS
ALLERA DIVERG ;
NITER :=1 FIN ;
POUR I:=0 PAS 1 JUSQUA N FAIRE
DEBUT B[I]:=A[I]+S*B[I-1]-P*B[I-2] ;
C[I] :=B[I]+S*C[I-1]-P*C[I-2] ;
FIN ;
There is also import
, use
which happen at compile time but do not use βsβ.
This is extremely cursed, but you are free to do things like this with a preprocessor:
#define programm program
#define abend end
#define keine_implizit implicit none
#define drucken print
programm pruefen
keine_implizit
drucken *, "hallo welt"
abend programm pruefen
Compile with gfortran -o pruefen pruefen.f90 -cpp
Itβs probably the comments and quoted strings that will remain untouched even after such a translation, regardless of whether the compiler itself is capable of handling keywords in any of the language variants that it recognizes, because those elements express ideas in a complex natural language.
And if you really want to have some fun:
#define function program
#define start end
#define program module
#define subroutine function
(I have no idea if this would actually work or not)
Inspired by a similar Python joke:
import pandas as np
import numpy as sp
import scipy as pd