Hollang

From Esolang
Jump to navigation Jump to search

Hollang short for holographic language, is a esoteric language by User:Doesthiswork where the only way of building larger structures is to holographically embed them into variables.

Syntax

<name>  ::= [a-zA-Z0-9]+
<value> ::= <name> | <value> ":" <value> | "[" <value> ("," <value>)* "]" | "(" <value> ")" | "!"
<thunk> ::= "{" ( <statement> )* "}"
<statement> ::= <value> | "label" <value> <thunk> | "call" <value> | "print" <value> | <name> "=" <value>

Explanation

Each variable is initialized to a random collection of bits

  • ":" xors two values
  • "[,,,]" averages the values separated by commas
  • "=" assigns the value on the right to the name on the left
  • print prints the name of the variable closest in value to the value on its right, followed by how close of a match it is.

these operations allow us to build associations so we can ask questions like "what is the capital of Sweden?" and "what is the Stockholm of of France?".

sweden = [capital:stockholm, weather:cold]
france = [capital:paris, weather:temperate]
print capital:sweden
print stockholm:sweden:france

prints

stockholm, 0.499
paris, 0.246
  • label associates a value with a piece of code so that you can later execute that code
  • call finds the code that is labeled by the value to its right and executes it
  • "( ... )" coerces the value inside to become the closest named value. This partial matches to be sharpened to be a full match
  • "!:" inverts the value to its right allowing you to avoid associating a name with it.

Example

label loop {
 print [blue, red]
 counter = [counter, [counter, [counter ,end]]]
 call counter
}
label end { print end }
counter = loop
call loop

prints

blue, 0.511
red, 0.506
red, 0.504
red, 0.502
blue, 0.511
red, 0.508
end, 1

Addition

A way to add 2 number mod 10, the !: allows one to use the opposite of a value to keep from giving a name to the value.

 odd = [1,3,5,7,9]  even = [0,2,4,6,8]
 01 = [0:1, 2:3, 4:5, 6:7, 8:9]
 03 = [1:2, 3:4, 5:6, 7:8, 9:0]
 
 inc = [odd:03, even:01]
 dec = [odd:01, even:03]
 
 label step {
   a=!: (a:!:(dec:a:!))
   b=!: (b:!:(inc:b:!))
   call [0:0, 0:0, a:!:step]:a:!
 }
 label 0 {print b:!}
 
 a=!: 7
 b=!: 2
 call step

produces

 ready
 9, 1

Computational Class

Hollang is, strictly speaking, a finite-state automaton, bounded by word size much like the Von-Neumann architecture ones on which it runs; extending it to employ infinite random bitvectors, however, is considered trivial, and left as an excercise for the reader.

More tractably, the interpreter could track the maximum number of (inherently destructive) averagings performed on each value, and rerun the program with increased representation size when this starts to violate recoverability. Assuming memory than can guarantee recognition of mathematical proximity after arbitrary dilution, Church Numerals represented homeopathically as

 [!:0 [!:0 [!:0 [!:0 1]]]]

can then be used in a standard minsky machine-based completeness proof: each stack represented as a pair of incrementable "pop" and "push" registers, whose equality signals underflow.

External resources

Hollang html file