Headsecks

From Esolang
Jump to navigation Jump to search

Headsecks is a brainfuck equivalent in which each character of the source code is interpreted as its ordinal value modulo 8, from which the instruction to execute is determined. It was designed and implemented by User: andkerosine in May 2012.

Overview

The conversion from Headsecks to brainfuck is, technically, up to the implementer. In the interest of compatibility, however, it is strongly recommended that the following mapping be adhered to:

  ord mod 8   0 1 2 3 4 5 6 7
  brainfuck   + - < > . , [ ]

This particular arrangement was a design decision, as it optimally maps spaces, tabs, and newlines to (reasonably) sane instructions, should one desire aesthetic spacing. Of course, there are (by definition) no limits regarding the structure one can impose on Headsecks code, and so the choice of separators (if any) is entirely open.

Syntax

Mathematicians have yet to discover a natural number which results in a negative remainder when divided by 8; as such, every possible string of characters is a valid (though not necessarily computable) Headsecks program. Here, for instance, are 16 different ways of writing the simplest infinite loop (+[]):

PҾз ʀҖΟ ȨжƧ ŸϞç ʠÞз Űņп ӠǶΧ àӎɇ ɘŮӯ @Ǯȿ аҞϧ ¸Ҟć ϠӶ· ψȮȷ Ɉʖ· ϘφÇ

Examples

Hello World (Trigrams dialect)

☰☰☰☰☰☰☰☰☰☰☶☳☰☰☰☰☰☰☰☳☰☰☰☰☰☰☰☰☰☰☳☰☰☰☳☰☲☲☲☲☱☷☳☰☰☴☳☰☴☰☰☰☰☰☰☰☴☴☰☰☰☴☳☰☰☴
☲☰☰☰☰☰☰☰☰☰☰☰☰☰☰☰☴☳☴☰☰☰☴☱☱☱☱☱☱☴☱☱☱☱☱☱☱☱☴☳☰☴☳☴

Note the use of an explicit newline to decrement the data pointer.

Konnichi wa (Kana dialect)

ビるィせセコびせかルゎチこるビびッセッべゃ゛ッびんんルィ゛ィらィんニスゃヘ゠だヰヒたヱィホゃかにつめこゃッっカッニほっほゃレひゴぴずもオげずやずオぺオヲず゜コんるニ゛ヴビぼケるニレよこコにルほこかコにャニコほッゴリぺ゚をぺぢヲなゲりりぺぴペぢなペゲぢひひゔべラが

Cat program

A repeating cat program which terminates if confronted with a null character input, and whose paregal constitutes the brainfuck code ,.[,.], constitutes the following:

EDFEDG

Implementations

At present, only the reference implementation (dead link) exists. You should improve this unfortunate situation.

  • Common Lisp implementation of the Headsecks programming language. Please note that the concrete character set deployed constitutes a dependency on the Common Lisp implementation; in corollary, Unicode support may or may not be a feature incorporated in the personal environment. The interpreter at hand has been developed and tested with Steel Bank Common Lisp (SBCL) version 1.1.4 as part of the Lisp Cabinet 0.3.5 bundle.
  • Python implementation of the esolang by User:None1. (Hint: Use ! to separate code and input)