CATHOL

The Programming Language of the Future

Scope of this page

This page is basically fun. Please do not take things too serious. However, there are two things I feel obliged to point out before:

First:

Cathol does exist.

And second:

All the benchmarks and data presented here are genuine.

This is part of the fun! It is a silly thing to invent a programming language and publish fictitious stuff about it (everybody can do that), but to invent it, implement it and test it - that is really amusing.

"Fun is a serious thing." (Terry Pratchett)

And oh yes, this page has nothing to do with either the Roman Catholic or the Catholic Apostolic church - time-honoured and respectable institutions. Though I'd suggested using it for applets and SSIs on the web page of the Order of St. Raphael (which I myself belong to), if we should ever have one. ;-)

What is CATHOL?

The name CATHOL is an acronym for Comfortably Apocalyptic, Totally Humanity-Oriented Language. It is also from the Greek kat' holos = "for everyone". Anybody who finds some homophony with COBOL or COMAL may be right or not.

Cathol is not an "obfuscated" or "weird" language in the sense of Intercal, Malbogle, Brainfuck or Befunge which were written just for the purpose of demonstrating that there will always be yet another (and probably more imbecile) way to skin a rabbit. Apart from currently having a very small library (console I/O, string handling and mathematics, but no file handling yet), it possesses all features of a general-purpose language, with generally utilizable data types and control structures. The syntax and semantics allow the writing of well-structured and legible programs. ...Well, at any rate Cathol programs do not comprise horrors like #define varp_from_x( x, t ) ( (t)==c_VInt ? &(IVartab[(x)]) : ((t)==c_VReal ? &(RVartab[(x)]) : &(SVartab[(x)])) )!

When attempting to classify Cathol in terms of conventional languages, we can describe it as follows: It is

In general, it bears some similarity with more elaborate BASIC dialects such as GFA BASIC or Omicron BASIC. It differs from what is generally known as "Basic" in that it does not use line numbers, GOTOs or GOSUBs. Instead, it has procedures, loops and if-then-else statements.

In many respects, its structure resembles that of COMAL, but who in turn knows what that looks like? The most striking feature of Cathol is that it is not based on the English language. So far, there are only two other languages for which this holds true: APL, which uses hieroglyphic signs, and Logo, which is available in both English and "localized" versions. Cathol, on the other hand, is based on the Latin language, which was considered to be much more appropriate for a computer language. Therefore, it does not fit any established linguistic category.

A code sample follows:

INCIPIT CANTUS fibonacci CUM fibn
   OBSCURA a b c
   FIAT a 1
   FIAT b 1
   NUMERABIS n AB INITIO 3 USQUE AD fibn
      FIAT c a+b
      FIAT a b
      FIAT b c
      SI fibn MAIOR 3
         SCRIBE c
         FRANGE
      ALIAS
         ORA "Domine te laudamus"
      NISI
   PROCEDE
   ILLUMINANDO REDDE c
AMEN

PAENITENTIAM AGE
   FIAT fibo30 @fibonacci 30
EGO TE ABSOLVO

Latin was chosen for a number of reasons:

  • We have had "business oriented" languages more than enough... the time is ripe for a language which takes into account our rich cultural heritage.
  • Latin is the traditional language of scholars, philosophers and scientists (in Europe).
  • Unlike English, whose grammar is defined largely as its own absence, Latin is based on a set of rigidly defined rules.
  • These allow for easy and brief definition even of complicated matters (try to translate the phrase illuminando redde from the example above into English, then count the words!).
  • It is a language that "belongs to" no one and hence cannot be abused in any attempt to demonstrate supremacy of one nation over another.
  • It also promotes peace and liberty throughout the world. Some of my best friends are dictators, and only very few of them speak Latin.
  • And finally, programmers who wear cowboy boots usually also don't know it and don't want it.

Download / Order

Structures & Types

Variables:

Flow control:

There are no indentations required, but Cathol permits only one command per line.

The library

...currently comprises mathematical functions and the commands SCRIBE (write) and FRANGE (break) for console output and control.

There is also the command ORA (pray) which evaluates an expression and sends the result to, nobody knows where.

Scope of identifiers:

In Cathol, all variables are basically (no pun intended) global. The only exception are parameters, which are local to their "cantus". However, the OBSCURA / ILLUMINA mechanism permits to declare a list of variables as local to any block of code. As this will usually be a procedure, there exists the specialized phrase ILLUMINANDO REDDE which returns a value while at the same time terminating the local space. So in the example a, b and care de facto local to the procedure fibonacci.

Peculiarities:

In the interest of speed and stability, Cathol is as static as can be. True, for obscuration dynamic memory allocation is required (very much at the cost of speed), but in general, the interpreter grasps a few big chunks of memory at startup which it releases during shutdown. In the time between, this memory is treated as a rigid array.

Cathol does not like complex expressions. There are many cases where, unlike almost all other languages, a variable or constant is required which may not be replaced by an arithmetic expression. For example, function calls demand such unitary arguments: INVOCA @function variable-1 variable+1 (as in most other languages: function( variable-1, variable+1) ) is not a valid Cathol expression; you must first do something like FIAT prevvar variable-1 and FIAT nextvar variable+1, then you can call INVOCA @function prevvar nextvar. This was introduced on purpose (actually the parser were capable of a little workaround: INVOCA @function (variable-1) (variable+1) would prevent it from getting confused about the proper assignments, but a deliberate syntax check causes this to be rejected) in order to enforce a maximum of clarity: When the intermediate result is stored in a named variable, the meaning becomes much more obvious.

Actually, there's more to this. As types can be freely converted, the meaning of operators may depend on the result expected, as said before. However, a command such as SCRIBE will accept any result. Therefore, the formula SCRIBE 4+"5" is not defined properly: Is this to be interpreted as 4+5 -> 9 or as "4"+"5" -> "45"? It becomes unambiguous, however, if we enforce it with something like FIAT result 4+"5" orFIAT $result 4+"5".

There is another sophistication. In function calls (as different from procedural invocations), the called function's parameters are used to generate expectations. Therefore, if we have a CANTUS INCIPIT fibo CUM n, it is legal to write FIAT r (@fibo n-1)+(@fibo n-2).

There is no operator precedence whatsoever in Cathol. When you spend two hours of debugging just to find out that the C term *++x->y-- should actually have read *(++x->y--) or maybe *(++x->y)--, you begin to hate implicit precedence as much as the implicit declarations in FORTRAN. Therefore, all operators associate to the right, causing the slightly surprising effect that RADIX 2 * RADIX 2 evaluates not to 2 but to 1.6817928305074292 (because the interpreter reads this as RADIX( 2 * RADIX( 2 ))). You can put everything right by proper bracketing (what's wrong about writing, once more in a slightly LISPish manner, (RADIX 2) * (RADIX 2) anyway?)

CATHOL compared to other languages

This section is largely equivalent to the corresponding part from the Morgul pages.

FAQs

So Mote It Be. God help me. Paenitentiam agamus. Amen.