spookyc

A compiler for the ๐ŸŽƒ Spooky ๐Ÿ˜ฑ programming language ๐Ÿ‘ป


The Spooky Programming Language ๐Ÿ‘ป

At the bleeding edge of programming language research, theoreticians structure problems intractable for the retention of the mental context of a single human mind into explicit semantics, their efforts weighted across the axis of expressiveness.

Among these computations determined too onerous for more affable turing machines, memory management has thrived in the zeitgeist, with such implementations as rust and ATS holding court upon many a Hacker News thread. Distributed systems are no less favored, with Erlang and Ponylang side projects blooming increasingly lush in Githubโ€™s harvest season.

But there is one clade of computational semantics that remains too labyrinthine, too daring for the eye of even our most maverick programming language academics: writing spooky programs.

Until now.

Introducing:

๐ŸŽƒ The Spooky Programming Language ๐ŸŽƒ

๐Ÿ‘ป boo! ๐Ÿ‘ฟ  ๐Ÿ˜ˆ ๐Ÿ’€
  ๐Ÿคก spooky_list๐ŸŽƒ
  spooky_list ๐Ÿ˜ฑ ๐Ÿซ 1 ๐Ÿฌ 2.5 ๐Ÿฌ "uh oh skeletons" ๐Ÿฌ ๐ŸŒ ๐Ÿฌ ๐ŸŒš ๐Ÿฌ โšฐ๏ธ ๐Ÿญ๐ŸŽƒ
  print_and_then_scream๐Ÿ‘ฟ spooky_list ๐Ÿ˜ˆ๐ŸŽƒ
  ๐Ÿฌ โšฐ๏ธ๐ŸŽƒ
โ˜ ๏ธ

The Programming Language of Fear ๐ŸŒš

Spookylang stands behind but one goal: to be the scariest programming language. Yes, I know, โ€œWhat about Java 7?!โ€ as you wheel around to high-five your coworker. Enough merriment.

In order to write Spookylang, our primary researcher first had to truly understand the meaning of fear. Failing to do that, our researcher instead proposed these language features:

Spooky-Completeness ๐Ÿ˜ˆ

Simply put, Spookylang is a procedural, mostly dynamically typed machine that can be programmed to execute any computable functions that take โ€œscaryโ€ input and output โ€œspookyโ€ output. This property (henceforth referred to as Spooky completeness) is isomorphic to Turing completeness by way of the following reversible morphisms:

let n be any string 
let ๐Ÿคก be any spooky string
let ๐ŸŽƒ be a scary word

N + ๐ŸŽƒ -> ๐Ÿคก
๐Ÿคก - ๐ŸŽƒ -> N

To enforce this invariant, the Spookylang compiler provides I/O routines that crash upon being passed โ€œnon-scaryโ€ strings.

Determining Scariness of Strings ๐Ÿ’€

The problem of binary categorization of arbitrary input is well known to the artificial intelligence community. For our own purposes, we employed an โ€œAI hardcoded list of regular expressionsโ€ that clusters strings according to the following policy:

Artifical Intelligence Hardcoded List of Regexs

Vari(scary)ables ๐Ÿ‘น

In a good program, variable names must be terse, but expressive.

In Spookylang they must also be scary, or your program wonโ€™t compile.

The Spookiest Emojis ๐Ÿ˜ฑ

Thereโ€™s nothing less scary than a keyword.

.. Except in Spookylang where all keywords are spooky emojis!

Jump Scares ๐Ÿคก

Surprise is a key element of being scared.

It will come as no surprise to you, then, that Spookyland employs the element of surprise in its mandate to spook. Not unlike MongoDB, the spookylang runtime will occasionally and unpredictably produce terrifying output.

Building It ๐Ÿฌ

The Spookylang compiler is written in WOAH!Caml, a dialect of OCaml wherein the programmer must be

  1. Sweaty
  2. Relatively new to OCaml
  3. Screaming

In order to protect our practitioners from the rank OCaml-building amateurity of our researchers weโ€™ve provided a docker-based workflow. Provided you have a relatively modern version of docker installed, you may brace yourself against the overwhelming senselessness of fear and run ./docker-compile.sh examples/hell_world.spooky to test out an example (the first time will run a bit slow due to building the docker image and the aforementioned OCaml-building amateurism - over 200 compiler warnings, sorry Jane Street!).

docker-compile.sh will build and persist a docker image dubbed spookybox (donโ€™t go in there!), and can be run on any spooky file you desire. This very repo helpfully contains a decent amount of source files in the examples subdirectory.

Documentation isnโ€™t as scary as the other stuff

but is nonetheless included here.

The worldโ€™s scariest examples can be found in the examples directory.

Test your mettle

Finally, something that isnโ€™t scary; we have tests! Run them with docker-compose up.