Nov 01

New Language – Lovecraft

I probably should have written this yesterday, but inspiration strikes at odd moments.

Announcing the new language – Lovecraft. It is inspired by the writings of the famous horror author HP Lovecraft, to maximize the thrill of programming.

Here’s the structure:

  • The basic semantic structure is Ruby-like, but only in appearance. Its true nature is far more sinister.
  • Lovecraft is, of course, interpreted. And, most importantly, in the past tense.
  • You start with a number of threads, as many as you choose to allocate. Lovecraft is a highly concurrent language. The first one is the “Judge”, responsible for managing the rest. However, you can’t ever increase your threads – they will only decrease over time.
    • Note that you don’t have to call it the Judge – you can also call it the Magistrate, the Investigator, the Governor, the Constable, the Examiner or the Sherrif – your choice.
  • Once a Lovecraft program starts, it will only end badly.
    • If a Lovecraft program “reaches the end” it will automatically start back at the beginning, possibly with fewer threads (see below)
  • The only variable type is String. And all Strings are automatically encoded in an ancient language (EBCDIC) each time they are set or adjusted. You must run the decoder each time you want to do anything with the String. Note that any errors in the decoding process will cause the contents of the String to become randomized, the various characters leaping into each others’ spaces, combining and separating in a bizarre and apparently random manner.
  • Strings are delimited by quotes, but you cannot use quotes inside a string. That would require an escape character, and there is no escape in Lovecraft
  • The only logical operator in Lovecraft is the “if_only…alas” operator as in:
    • if_only x equaled “5” i_could_end_this_madness() alas
  • There are no For loops, While, Do While or other looping constructs, other than Goto
  • The entropic madness of an uncaring and soulless universe causes your variables to “decay” over time, becoming statistically less likely to contain the correct answer the longer the program runs, and the more often you access the variables.
    • Note that each character in the String will degrade independently, and the probability of decay is uniform across the length of the String.
  • Introspection, or any attempt to debug the variables significantly increases the chance that the variable will decay
  • If you no longer need a variable, you can WasSacrificed() it. (Note the use of the past tense). Note also that, unusually, the variable name comes before the command:
    • if_only x did_not_equal “42”
      • x WasSacrificed()
    • alas
    • Note also that the more variables you sacrifice, the more entropy will be added to the overall program, increasing the likelihood that other variables will decay, so use WasSacrificed carefully!
  • Inevitably, your threads will stop operating properly as the variables decay into meaningless garbage. It is possible for the Judge thread to mark another thread as insane in order to stop it from running. However, as I noted previously, you cannot create new threads – you must continue on with the remaining threads you have. Note also that there is no definitive test of whether a thread is insane or not – the “Judge/Magistrate/Examiner/etc” must evaluate the thread and make a judgement based on its own, possibly unstable state.
  • At some point, the threads of sanity will be exhausted, and your program, lurching about erratically, spouting gibberish in EBCDIC must be WasCommited(). Committing a program does not end it – it merely leaves it forlorn and alone, occupying a small cell in your computer’s memory until such day as the great User decides to terminate its Universe forever.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>