Skip to content

Easy and standardized docker images for 200+ esoteric (and non-esoteric) languages.

License

Notifications You must be signed in to change notification settings

hakatashi/esolang-box

Repository files navigation

esolang-box 2.4.0 Build Status

Easy and standardized docker images for 200+ esoteric (and non-esoteric) languages.

Usage

Distributed docker images are separated for each esolangs.

For example docker image for Evil language is named as esolang/evil, which is hosted on Docker Hub.

How to run your own esolang program

Suppose you have program in the current directory,

$ echo aeeeaeeewueuueweeueeuewwaaaweaaewaeaawueweeeaeeewaaawueeueweeaweeeueuw > program.evil

then you can run the program like the following.

$ docker run -v `pwd`:/code:ro esolang/evil evil /code/program.evil
Hello, World!

Observing usage of exec syscalls

esolang-box 2.2.0 supports tracing of execve and execveat syscalls by strace command. Setting STRACE_OUTPUT_PATH environment variables and enabling ptrace will produce strace log to the specified path.

$ docker run --cap-add=SYS_PTRACE --rm -v `pwd`:/code --env STRACE_OUTPUT_PATH=/code/strace.txt esolang/evil evil /code/program.evil
Hello, World!

Some considerations:

Simple benchmark:

~ # cat benchmark.rb
sum = 0
1000.times do |i|
  seq = `seq #{i}`.split.map(&:to_i)
  sum = seq.sum
end
p sum
~ # echo -n "" | time ruby benchmark.rb
499500
real    0m 3.57s
user    0m 0.78s
sys     0m 0.70s
~ # echo -n "" | time strace -f -q -o strace.txt -e trace=execve,execveat ruby benchmark.rb
499500
real    0m 28.90s
user    0m 1.19s
sys     0m 13.73s

List of boxes

Notes about some languages

Bash (pure)

Simulates behavior of "Bash (builtins)" in Anarchy Golf.

BibTeX

  • \n in input is replaced as single space.
  • multiple spaces and `\n' in input are replaced as single space.
  • The script should call newline$ at tail of output.
  • input will be passed as input entry.
  • the style type is source.

Brainfuck (bfi)

Unlike Brainfuck (esotope), this execution simulates behavior of "brainfuck" in Anarchy Golf.

To achieve this, I have patched a tricky line to the original code.

--- BFI.c
+++ BFI.c
@@ -46,6 +46,7 @@
   int pc, args, xc, prog_len, l = 0;
   int x[32768];
   int p[32768];
+  int xxx[1] = {'['};

   FILE *stream, *fopen();

Compile-time C++ (Clang, C++11)

Write the constexpr function f that receives the const char* input as an argument and returns const char* output.

Coq

You can use coq.io.

Csound

Input file is given as input.in. You should write out to output.out.

Note: DO NOT LISTEN TO GENERATED PROGRAM, IT MAY CONTAIN UNEXPECTEDLY LOUD SOUNDS, AND MAY CAUSE EAR DAMAGE.

FFmpeg

Input file is given as in.txt. You should write out to out.txt. You can use both video and audio.

Note: DO NOT LISTEN TO out.pcm, IT MAY CONTAIN UNEXPECTEDLY LOUD SOUNDS, AND MAY CAUSE EAR DAMAGE.

Make

Input is given as STDIN environment variable. This spec is equivalent to Anarchy Golf.

OpenOffice Calc

You can write CSV with the content below the B line.

The input is given in A1 cell.

Output the final result into B1 cell.

OSECPU and OSECPU-ASKA

Your program must follow these restrictions:

  • Graphical user interface is not available
  • debugging feature is not available
  • On OSECPU: accept OSECPU binary
  • On OSECPU-ASKA: accept OSECPU-ASKA source code
  • On OSECPU-ASKA: osecpu_ask.h and app.ask are available at the same directory

The input is given in an file at first argument. You can get the input as follows (see app0129):

Int32s fsize:R01;
VPtr p:P01;

junkApi_fileRead(fsize, p, 1);

The official archive is built on Windows. To develop on GNU/Linux, follow this article: takeutch-kemeco's note

Pxem

The first line is the file name of the pxem code.

The rest is the content of the pxem code.

XSLT

The input is given as the content of tag <input/>.

Transform that into the desired value.

Blacklisted languages

Below are the list of the languages that cannot even do the minimal jobs needed for esolang-battle.

  • ArnorldC
  • CodeMania (whitespace is automatically trimmed from input)
  • Doubleplusungood (whitespace is automatically trimmed from input)
  • Gaia (whitespace is automatically trimmed from input)
  • Haystack
  • LOGICODE (Can only take 0 or 1 from input)
  • ModanShogi
  • ~English
  • Python 1
  • РАПИРА (Input number/bool only)
  • Seed
  • STOP (Cannot input or output newlines)
  • ///
  • 🆒
  • TrumpScript
  • Velato
  • ZOMBIE

Build images

Prerequires dobi.

$ cd /path/to/esolang-box
$ ruby build.rb
$ dobi

Run spec

Tested with Ruby 3.0.0

$ bundle install
$ bundle exec rspec