Gödelang

From Esolang
Jump to navigation Jump to search

Gödelang is an esolang created by User:TJC games. It's based off of Gödel numbering, and it's just another Brain**** clone.

Interpretation

Each program is represented as a number, which is read by breaking it down into its prime factors and using the powers as the instructions. If it uses a number not listed in the below table, it's recompiled and run. The powers are as follows:

Gödelang 1.0 value BF alternative Instruction
0 end of file Terminate program
1 > Move pointer 1 byte to the right
2 < Move pointer 1 byte to the left
3 + Increase byte at pointer by 1
5 - Decrease byte at pointer by 1
7 ++++++++++++++++ Increase byte at pointer by 16 (= 100002)
9 ---------------- Decrease byte at pointer by 16 (= 100002)
10 . Output ASCII character stored in byte at pointer
11 , Input ASCII character and store in byte at pointer
13 [ If byte at pointer = 0, then skip to next 14
14 ] If byte at pointer != 0, then skip to previous 13
Gödelang 1.1 value BF alternative Instruction
0 end of file Terminate program
1 > Move pointer 1 value to the right
2 < Move pointer 1 value to the left
3 + Increase value at pointer by 1
5 - Decrease value at pointer by 1
7 . Output ASCII character stored in value at pointer
9 none Output value stored in value at pointer
10 , Input ASCII character and store in value at pointer
11 none Input value typed in (return to enter, any letters sets to 0)
13 [ If byte at pointer = 0, then skip to next 14
14 ] If byte at pointer != 0, then skip to previous 13
15 none If byte at pointer = 0, then skip to next 17
17 none No function, except for use with 15
19 [-] or [+] Set value at pointer to 0
Gödelang 2.0 value BF alternative Instruction
0 end of file, ], or none Terminate program
1 > Move pointer 1 value to the right
2 < Move pointer 1 value to the left
3 + Increase value at pointer by 1
5 - Decrease value at pointer by 1
7 . Output ASCII / UTF-8 / UTF-16 character stored in value at pointer
9 none Output value stored in value at pointer
10 , Input ASCII / UTF-8 / UTF-16 character and store in value at pointer
11 none Input value typed in (return to enter, any letters sets to 0)
13 [-] or [+] Set cell to zero

Notes for v2: If the sign is positive, it's a if loop. If the sign is negative, it's a while loop. In v2, you cannot have while ends in if loops. I don't think that there is a way to interpret one instruction as another, but if there is a valid prime factorisation sequence that, at the top level, only contains integers, then v2 is henceforth a null language.

Gödelang 2.1 value BF alternative Instruction
0 end of file, ], or none Escape routine
1 none Continue the current highest loop the pointer is in
2 none Escape the current highest loop the pointer is in
3 none Halt the program
5 > Move pointer 1 value to the right
7 < Move pointer 1 value to the left
9 + Increase value at pointer by 1
10 - Decrease value at pointer by 1
11 . Output ASCII character stored in value at pointer
13 none Output value stored in value at pointer
14 , Input ASCII character and store in value at pointer
15 none Input value typed in (return to enter, any letters sets to 0)
17 [-] or [+] Set cell to zero

Examples

Cat program

An infinite cat program, equivalent to the brainfuck code ,.[,.] and conforming to the Gödelang version 1.1, can be encoded in the Gödel number

59250896327476337572570276385712371250000000000

In version 2, the program seems to be too close to 0 to be calculated. It is equivalent to

24 * 5^(-452 093 906 250)

Truth-machine

Harnessing the possibility to input and output integer values, the Gödelang version 1.1 instructions 11, 13, 9, 14, 9 are realized in this program:

10198658019570622936267207428000000000

In V2.1, you can make a False-machine with a value of about

9.379611729124607607275091166441989701528439120907614371577518983495205001437233591184924079631645984935223821309430117923757748297E-1423

Interpreter

  • Common Lisp implementation of the Gödelang programming language. This includes an interpreter and converters betwixt brainfuck and Gödelang.