User:Salpynx/Braneflage

From Esolang
Jump to navigation Jump to search

{ This is a work in progress, attempting to document the intended design, and implemented behaviour of the current partial interpreter. Some aspects may change, there may be alternatives presented to explore }

The primary design goal of Braneflage is ostensibly to be an esoteric programming language where the dimensionality of the memory-data is less than that of the program-data. This allows the memory to comfortably inhabit the program space, and the whole system can be modelled somewhat physically, or at least topologically. In general, most other programming languages have a memory dimensionality greater-than-or-equal-to their source-code dimensionality [citation needed]

If successful, Braneflage will consist of a 1D memory object travelling over the 2D program surface of a wikipedia:g-torus, and be Turing complete.


Instruction Pointer / Memory

Data is stored in an accumulator, α. The instruction pointer is the Braneflage memory object.

It can be thought of as a line segment / vector. It has the following attributes:

  • Length (magnitude); representing the accumulator α
  • Location (origin); marking the current program instruction
  • Orientation; pointing towards the next instruction
  • Spin; (CW / CCW)


Program Commands

Program instructions in Braneflage are laid out on a two dimensional grid (which is embedded in a higher dimensional space)). Unlike other fungeoid languages whitespace is not generally traversable, but the instruction pointer can loop to connected parts of the same structure that are aligned horizontally or vertically. This is {intended to be} topologically a g-torus (rather than the 1-torus of languages like Befunge.) There is a NOOP symbol x to allow regions to be connected horizontally and vertically.


Accumulator Operations
Symbol Name Description Δα
+ Expand Expand α
- Contract Contract α
> Grow Grow α
< Shrink Shrink α

Where:

and

Control Flow
Symbol Name Description
O Orthogonal Test (CW) CW-Test α, rotate spinwards and flip spin if True
C Orthogonal Test (CCW) CCW-Test α, rotate spinwards and flip spin if True
x NOOP No operation, but counts for determining connected regions
@ Halt Stop program execution


Input / Output
Symbol Name Description
, Value out Output v(α)
. Character out Output v(α) as ASCII / byte
= Accumlulator Output α
~ Input α = input(α, c)

Control Symbols

{ under developement }

There are potentially a number of ways to specify the rotation controls O and C

  • O: test(α) ^ CW(α)
  • C: test(α) ^ CCW(α)

If result is True, rotate orientation in the direction of spin, and flip the current spin.

Otherwise, continue in the current heading.

Alternative formulation (not relying on spin):

O:

  v
>[ ] 0
  1 

C:

  v
>[ ] 1
  0 

{ The details above may change depending on what other features are added to this specification. }

Program Flow

The instruction pointer moves through the loops of the playfield, changing length, orientation, and spin, occasionally providing output based on the value of α. When a @ symbol is encountered, execution halts.

Examples

This is a basic Hello World program for testing:

++++++++O>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.=@
        >
        +
        +
        +
        +
    <<<-C>++>+++>+++>+<
        >
        +
        >
        +
        >
        -
        >
        >
        +
        C<
        <
        -

Which produces:

Hello World!
<4065266629575684715872314458133>


External resources

wikipedia:Genus_g_surface