Happy Fantasy

From Esolang
Jump to navigation Jump to search
Happy Fantasy
Paradigm(s) Functional, Declarative, String-rewriting
Designed by User:Hakerh400
Appeared in 2020
Computational class Turing complete
Major implementations Interpreter
File extension(s) .txt

Happy Fantasy is a Golden sunrise derivative which supports function names (mnemomics for arrays of bits).

Overview

Syntax is identical to Golden sunrise, but all identifiers are enumerated and replaced with sequences of bits according to the User:Hakerh400/Prefix-free serialization algorithm for Arbitrary-sized non-negative integer. Then the resulting source code is interpreted as a Golden sunrise program.

Also, all rules that are not specified will be implicitly defined to produce empty strings.

Examples

Add n zeros after n-th 1

main - (add(remove.))
remove 0 - (remove.)
remove 1 - 1(remove.)
add 1 - 10(extract.)(add.0)
extract 0 - 0(extract.)
extract 1 - (extract.)

It translates to the following Golden sunrise program:

0 - (100(101.))
1010 - (101.)
1011 - 1(101.)
1001 - 10(11.)(100.0)
110 - 0(11.)
111 - (11.)
# - /
1# - /
10# - /
101# - /
1000 - /
100# - /
11# - /

Interpreters

Interpreter