TheLang

From Esolang
Jump to navigation Jump to search

TheLang

TheLang is an esoteric programming language by User:Tema5002 derived from Brainfuck. It's primary interpreter is written in C.

How It Works

Command Number
< 0
> 1
+ 2
- 3
. 4
, 5
[ 6
] 7

To rewrite a program from Brainfuck to TheLang, follow these steps:

  1. Convert each command to its corresponding number
  2. Convert the reversed sequence to an octal (base8) number.
  3. Enter that many "the"s.

Example

Let's encode this Brainfuck code:

--.

It prints character letter thorn (U+00FE in unicode).

  1. Convert the numbers: --. -> 334
  2. Convert reversed sequence to octal number: 334 -> 0o433 (283)
  3. Append the that many times
tema5002@polyester:~$ git clone https://github.com/antigrav-technologies/TheLang.git
...
tema5002@polyester:~$ cd TheLang/
tema5002@polyester:~/TheLang$ make all
gcc main.c -o TheLang -O3 -Wall -Wextra -Werror -lm
tema5002@polyester:~/TheLang$ python3 -c 'print("the "*0o433)' > a.the
tema5002@polyester:~/TheLang$ ./TheLang a.the
þ

The program looks like this:

the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the the

Another example

Let's encode this code:

.+[.+]

It prints the entire ascii charset.

  1. Convert the numbers: .+[.+] -> 426427
  2. Convert reversed sequence to octal number: 426427 -> 0o724624 (240020)
tema5002@polyester:~/TheLang$ python3 -c 'print("the "*0o724624)' > a.the
tema5002@polyester:~/TheLang$ ./TheLang a.the
	


�123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
        tema5002@polyester:~/TheLang$

I would show more examples, but I will run out of storage. Feel free to use TheLang to test your storage capacity.

Implementation

See also