![]() |
CATHOL
The Programming Language of the Future |
![]() |
Scope of this page |
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? |
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 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:
| ![]() |
Download / Order |
Structures & Types |
Cathol supports three data types: integers, floats and strings. As in BASIC or PERL, types are designated by prefixes: % (or nothing) for integers, ! for floats and $ for strings. Hence, no declaration is required.
An integer is a 32-bit integer, or whatever value has been chosen during compilation of the Cathol interpreter. Logical values are special instaces of integers - 0 is "false" and all other values are "true". Therefore, comparisons (using EQUALIS, INEQUALIS, MAIOR, MINOR, MAIEQU and MINEQU) are just operations like +, - and so on.
A float is a C float or double value.
A string is any sequence of up to 255 ASCII characters. Unicode is for ninnies.
All three types are freely interconvertible. That is to say, a string may be used as an integer or a real (then it is sscanfed internally to yield a numeric value), an integer may be used as a string (then it is sprintfed intenally) or a real (the easiest conversion), and a real may be used as a string or an int (then it is rounded). The phrase "3"+4 is perfectly legal in Cathol. Whether this is evaluated to "34" or to 7 depends on the variable to which it is to be evaluated: If it is a string variable, the expression is evaluated to yield a string; if it is numeric, the expression is evaluated to yield a numeric value. You may even write: FIAT !float "3"+4 and get 7.0000000.
There are no structured data types. (They are only for quiche eaters anyway, aren't they? Folks who speak the language of the Caesars don't tinker with such gimmicks.)
There is no := (Pascal), <- (ML) or = (C) operator; instead, assignments are done using the command FIAT, similar to SETQ in LISP or LET in some older BASICs.
There are no indentations required, but Cathol permits only one command per line.
Procedures may be directly or indirectly recursive. In the example, fibonacci takes one parameter. Arguments and parameters must match.
There is also the command ORA (pray) which evaluates an expression and sends the result to, nobody knows where.
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.
Back in the 1960s, Clarke, one of the more intelligent
sci-fi writers (there were in fact intelligent writers in those bygone days), allowed himself to be
inspired by the Towers of Hanoi puzzle to a story whose plot is about an order of monks who are bent
on writing down all the names of God. According to their faith, God's name comprises nine sacred
letters, and any permutation of these is one of His names. Now the monks wish to automatize their
task.
This is pretty simple: Just use nine interlocked cycles in order to print all permutations
from AAAAAAAAA to IIIIIIIII. Forgive me my desire to see the beginning of a new world, but I also
checked this:
| Language | secs |
| Common Lisp | ~ 6000 |
| Java | 3 |
| C | 3.7 |
| Python | 2096 |
| Cathol | 1511 |
| Language | Fibonacci | Iterative Fibo | Roots |
| Common Lisp | 7.3 sec / 5.8 sec | 454 µsec / 200 µsec | 520 msec / 485 msec |
| Common Lisp, compiled | 1.06 sec | 41 µsec | 194 msec |
| Uncommon Lisp | ~35 sec | *** | *** |
| Scheme | 31 sec | ~700 µsec | ~750 msec |
| Xscheme | ~2.5 sec | *** | *** |
| Guile | ~7 sec | ~400 µsec | ~470 msec |
| Silk | 26 sec | 610 µsec | 800 msec |
| Erlang | 0.06 sec | 39 µsec | 16 msec |
| Haskell (HUGS) | 81 sec | *** | *** |
| Haskell (GHC) int./comp. | ~6 sec / <<0.5 sec | *** | *** |
| Python | 2.71 sec | 53 µsec | 303 msec |
| C | 0.06 sec | 0.19 µsec | 3 msec |
| Java | 0.05 sec | 0.48 µsec | 6 msec |
| CATHOL | 6.73 sec | 22 µsec | 16 msec |
To sum it up: Cathol is pretty fast!
Well, I worked hard to implement this only to find out that one of the chips on my computer's board clandestinely sympathizes with Al-Qaida and blew up the stuff as soon as it was set up! And currently I do not have the money for a new chipset. So there will be no Towers here, I am afraid...
FAQs |
Probably I am expected to thank somebody here, only I do not know whom. The plain truth is: I, me, myself, the Chevalier Dr. Dr. Rüdiger Marcus Flaig, did it all on my own. Nobody helped me, no code was reused, nothing. It is a de novo creation (generatio spontanea, for those who already know Latin). Likewise, I did not use any literature or documentation except for the glibc docu.
Cathol was written on January 15th, 2003 and debugged and tested during the following week.
For your convenience, we offer two alternative licensing schemes.
OPEN SOURCE: The whole program, source and all, is licensed
under the GPL (see http://www.gnu.org) which may be roughly
summarized like this:
It is free and provided on an "as is" basis. We hope that you'll enjoy it, but we
do not guarantee fitness for any particular purpose. Take it or leave it; feel free to
use it, read it, learn from it, modify it, even make money out of it, but abide by the following golden
rules:
|
MICROSLAVERY (x86 machines only): For the Amazingly Low Price® of only 995,- you will Get The Registered Executable But Nothing Else®, which you May Try To Install® on your computer, provided that you also have registered copies of MS-Inquisition®, MS-Orcware® and MS-Sneak And Pry® installed. If this Wrecks Your System® or Causes Trouble®, this is Your Own Problem® and There's Nothing You Can Do About It®. Our special service program includes that You Must Not Analyze The Code®. Because if you were allowed to, you might be able to hand in a bug report, and this would require some reaction on our side. We are convinced that What We Give You Is Good Enough For You® and you are not permitted to bother us, still less to make suggestions what we should change. Always keep in mind that We Are The Champions And You Are A Doofus®. Though your hard disk is going to be Flooded With Irritating Lots Of DLL Files®, you will also Get Lots Of Error Messages® to the tune of "Could not find DLL xxxx". If, however, the program should run (which we have taken great care to avoid, but sometimes it just happens), it has A Limited Life Time®. After 366 days, you will be Asked To Renew Your Contract® for the Amazingly Low Price® of only 666,-. If you decline, the program will Really Do Mischief®, that is to say, it will remove itself after Crashing Your Hard Disk®, Kicking Your Poodle®, and Seducing Your Wife®. Of course, all this will not save you from being pestered with Lots Of Annoying Pop-Ups®, Childish Yellow Plastic Dogs® and a Plethora Of Idiotic Trademark Signs® all the time, nor from having all your most confidential data being sent to us. "There cannot be a categorical imperative without a categorical imperator" (Nietzsche) ... and You Have Just Found Yours®! | ![]() |
Which one to select? Common sense would probably not require a second to decide, but for some unintelligible reason more than 95% of users still prefer the Microslavery scheme...
Download current version of source code (GPL)
Order
executable (Microslavery)
Download FREE test suite (Zip archive)
There can be only one... C. Not C++, not C#, not Objective C, but plain and simple ANSI C ("separates the men from the boys"). It was written on a Linux system named cirith-ungol (a Pentium-III/933, 256 MBytes RAM laptop) using gcc (the GNU C compiler) version 3.2, using, of course, the "--no-warnings" flag. No risk, no fun.
And of course, I did not use KDE-develop, Anjuta or any other IDE. If you can't do it using Emacs, consider doing something else.
To use the timer, the rt lib is required, but apart from that, there should be nothing in this which would overstrain a K&R compiler from the 1970s. So the proper answer is: All. Okay, I know that somebody will now turn up with his old Sinclair ZX81 or Schneider CPC... It requires a C compiler, of course. And, depending on the #defines, a bit of RAM. I have not checked this but I think below 2 - 3 MB of RAM it won't work. Bad luck for those of you who are still clinging to their Apple Lisa because they paid $30,000 for it some twenty-five years ago.
Not yet, but if you want to implement JATHOL, you are certainly welcome.
C'm on man, this is one file only.
The fact that you are thinking in terms of "setup.exe" indicates that you are completely indoctrinated by Microslavery. Well, this is curable. I underwent a compulsory detox in 2001 and have been clean ever since.
Cut it out, will ya? This thing was written just for fun. You are not meant to use it for any serious purpose. It is not even complete, and there are probably more bugs in it than I have dealt out sword-blows in my life, and that's quite a number. Anyway, I did not invest more than 20 hours of work in it all in all. If you enjoyed it, and would like me to continue, I would appreciate all detailed bug reports.