Daoyu

Dàoyǔ (道语), or DaoLanguage, is an esoteric programming language made by User:Kaynato in 2016, modeled after about two or so tenets of Daoist philosophy. It is inspired by other elegant and minimal programming languages such as Iota, Jot and FALSE, though the actual functionality bears little resemblance to that of those.

Primary aspects of the language are: Lack of numeric assignment Lack of mathematical operations Lack of random memory access Lack of incrementation of data Lack of decrementation of data Lack of typical bitwise operation Two-dimensional traversal of a program stack(?) Nested programs Self-disabling functionality Limited conditionals Equal treatment of all programs and data

Since Daoyu tetrad code covers all possible combinations of 4 bits, and most computer files are written as multiples of bytes, any file is technically a valid Daoyu program. However, it is likely that attempting to run most files as such would result in either an explosive (memory overloading), infinitely looping, or quickly self-terminating program.

It has a compiler and interpreter written in C.

Writing in Daoyu
Daoyu always operates on bit-tapes of power-of-two length. The bit-tape is called a Path, or Dao. New Paths are initialized with one zero bit allocated, selecting only this single zero bit.

When a Daoyu program is run, its binary code is used to create a new Path on which is called EXECS. In a way, this can be viewed as a sort of "main function."

Daoyu recognizes two file extensions: * .dao - symbolic source code (for compilation) * .wuwei - compiled tetrad code (for execution)

.dao is a text-editable format containing the 16 Daoyu Human-Friendly Symbols, and comments:



Regarding comments: All invalid symbols, or characters in a line after ‘@’ will not be read by the compiler.

The following table describes the functionality of “Level.” At the level shown on the left hand column, the functionality of the symbol first defined at level 0 should be altered to that at the appropriate row of level. For example, at level 1, SPLIT is interpreted as HALVE and DOALC is treated as IDLES.

Generally, "Level" is used to selectively disable functionality typically only executed once for the purpose of initialization. For example, DOALC, if looped, can severely confuse the selection length and consume memory, while SPLIT will usually cause information to be lost from future program states. However, as SPLIT also is used to alter the selection location, the first "Level" only causes SPLIT to be interpreted as HALVE.



Data, Selections, and Nesting
Let us have a .dao file that we are running.

The translated binary code from this .dao file that is loaded into the interpreter is called the "Top Level Program," or TLP.

In loading the TLP, the interpreter creates a path with the smallest size greater or equal to that of the TLP, and then reads the TLP into the path data.

Then, the interpreter selects the first bit of the TLP, and calls EXECS, generating a new path owned by the TLP.

Whenever EXECS is called on a path that does not have a child, it creates one with one zero bit.

These paths, being the central data element of Daoyu, are binary strings that may only have bit sizes that are powers of two.

A selection represents the "active range" for commands that may act - for example, SWAPS (!) only switches the bits in the halves of the selection.

A child tape may be destroyed by calling DEALC on it while its length is one - that is, calling DEALC on a tape of only '0' or only '1'.

One may call EXECS on a program that already has a child tape - in that case, that program will execute its data as commands on the pre-existing tape, keeping the existing selection size of the child tape.

Commands
The functionality of the symbols is as follows. Examples of functionality are provided in the fourth column in the format: BEFORE_SYMBOL AFTER_SYMBOL Except in the case where multiple levels of data are involved.

1 and 0 indicated selected 1 and 0, while 'i' and 'o' indicated unselected 1 and 0. Other letters indicate arbitrary bits, with uppercase indicating selection and lowercase indicating deselection.

.wuwei is a compiled, binary code data file that can be directly read as a Daoyu program.

When a .dao file is compiled, the symbols are replaced with the 4-bit codes as shown in the above table. The interpreter or compiler, when provided with the .wuwei file, should then load the data directly into memory as an unbroken data tape and call EXECS from its beginning.

A .wuwei file can be edited by a hex editor, but is not as human-friendly in editing as .dao files are, since comments are difficult in the limited alphabet of hexadecimal code.

On Writing in Daoyu
Print-out programs: The methods are to: - Make ASCII codes in the data and read over them (see helloworld.dao) - Write ASCII for your intended output inside the source, selecting and reading the appropriate sections.

Input-filtering programs (see truth.dao): Use a combination of SWAPS, POLAR, and EQUAL to check for the bit state of the input. With UPLEV, one can cause the program to re-request a character (or other input), and with DEALC, one may terminate the program (as in truth.dao). It may be necessary to write a program inside your data (preferably at its end, so that the program does not read the data) which also checks and manipulates your data. It is suggested to funnel all unwanted states into the same state.

Counting: (To prove) Identify a permutation cycle on a bit state using the same operations each time. The state should also be able to be read in a different way so as to retrieve the "number."

Memory: (To prove) Keeping bits in a partition before the program's beginning.

Functions: (To prove) Constructing DEALC-terminated programs in different partitions.

Functionality to Explore
Moving the data pointer into the main program and calling EXECS. If the "main program" (Which starts from the beginning) is DEALC-terminated, could this be used to massively simplify "Function" functionality?

Example Execution (helloworld.dao)
Log from dao helloworld.dao -v

The "Floor" is the "depth" of a data - that is, the initial program data is F0, the data that writes to is F1, and if that data were to be executed, the data that would act on would be F2, and soon.

In verbose execution, the output may contain more than the output of READS.

Format:  R W L   : 

Compiling to helloworld.wuwei $$ EE $( E8 ([ 8C ]! 31 )/ 32 ([ 8C ]) 33 ): 3A (( 88 /[ 2C ]) 33 /( 28 [] C3 !/ 12 [] C3 !) 13 ): 3A (/ 82 [] C3 ): 3A :[ AC /( 28 [] C3 !/ 12 [] C3 )] 33 !: 1A CC [] C3 ]! 31 ]: 3A [( C8 [] C3 !) 13 /[ 2C /[ 2C ]! 31 ]! 31 ]: 3A [/ C2 ([ 8C ]! 31 /[ 2C ]) 33 ]! 31 :[ AC ([ 8C ]! 31 )/ 32 (/ 82 [] C3 )] 33 :( A8 (/ 82 [] C3 )/ 32 [] C3 ): 3A (/ 82 ([ 8C ]! 31 )) 33 :( A8 [[ CC  33 !/ 12  CC ]! 31 ]! 31 ): 3A [[ CC [] C3 /[ 2C  33 ]! 31 :. a0 Finished compiling.

=====================	|Beginning Execution| =====================

Running helloworld.wuwei. Loading data: Allocated 128 bytes for 76 byte file. Read 76 bytes.

EEE88C31  328C333A   882C3328   C312C313   3A82C33A   AC28C312   C3331ACC   C3313AC8 C3132C2C  31313AC2   8C312C33   31AC8C31   3282C333   A882C332   C33A828C   3133A8CC 3312CC31  313ACCC3   2C3331A0   00000000   00000000   00000000   00000000   00000000 00000000  00000000   00000000   00000000   00000000   00000000   00000000   00000000   (128 bytes)

Allocated 40 bytes.

00000 R0 W1 L0 $ 0 : 00001 R0 W1 L0 $ 00 : 00002 R0 W1 L0 $ 0000 : 00003 R0 W1 L0 ( 00000000 : 00004 R0 W1 L0 ( 00000000 : 00005 R0 W1 L0 [ 00000000 : 00006 R0 W1 L0 ) 10000000 : 00007 R0 W1 L0 ! 10000000 : Swapped length 2. 00008 R0 W1 L0 ) 01000000 : 00009 R0 W1 L0 / 01000000 : 0000A R0 W1 L0 ( 01000000 : 0000B R0 W1 L0 [ 01000000 : 0000C R0 W1 L0 ) 01001000 : 0000D R0 W1 L0 ) 01001000 : 0000E R0 W1 L0 ) 01001000 : 0000F R0 W1 L0 : 01001000 : H 00010 R0 W1 L0 ( 01001000 : 00011 R0 W1 L0 ( 01001000 : 00012 R0 W1 L0 / 01001000 : 00013 R0 W1 L0 [ 01001000 : 00014 R0 W1 L0 ) 01101000 : 00015 R0 W1 L0 ) 01101000 : 00016 R0 W1 L0 / 01101000 : 00017 R0 W1 L0 ( 01101000 : 00018 R0 W1 L0 [ 01101000 : 00019 R0 W1 L0 ) 01101000 : 0001A R0 W1 L0 ! 01101000 : Swapped length 2. 0001B R0 W1 L0 / 01100100 : 0001C R0 W1 L0 [ 01100100 : 0001D R0 W1 L0 ) 01100110 : 0001E R0 W1 L0 ! 01100110 : Swapped length 2. 0001F R0 W1 L0 ) 01100101 : 00020 R0 W1 L0 ) 01100101 : 00021 R0 W1 L0 : 01100101 : e 00022 R0 W1 L0 ( 01100101 : 00023 R0 W1 L0 / 01100101 : 00024 R0 W1 L0 [ 01100101 : 00025 R0 W1 L0 ) 01101100 : 00026 R0 W1 L0 ) 01101100 : 00027 R0 W1 L0 : 01101100 : l 00028 R0 W1 L0 : 01101100 : l 00029 R0 W1 L0 [ 01101100 : 0002A R0 W1 L0 / 11110000 : 0002B R0 W1 L0 ( 11110000 : 0002C R0 W1 L0 [ 11110000 : 0002D R0 W1 L0 ) 11111000 : 0002E R0 W1 L0 ! 11111000 : Swapped length 2. 0002F R0 W1 L0 / 11110100 : 00030 R0 W1 L0 [ 11110100 : 00031 R0 W1 L0 ) 11110110 : 00032 R0 W1 L0 ) 11110110 : 00033 R0 W1 L0 ) 11110110 : 00034 R0 W1 L0 ! 11110110 : Swapped length 8. 00035 R0 W1 L0 : 01101111 : o 00036 R0 W1 L0 [ 01101111 : 00037 R0 W1 L0 [ 11110000 : 00038 R0 W1 L0 [ 11000000 : 00039 R0 W1 L0 ) 10000000 : 0003A R0 W1 L0 ) 10000000 : 0003B R0 W1 L0 ! 10000000 : Swapped length 4. 0003C R0 W1 L0 ) 00100000 : 0003D R0 W1 L0 : 00100000 : 0003E R0 W1 L0 [ 00100000 : 0003F R0 W1 L0 ( 11110000 : 00040 R0 W1 L0 [ 11110000 : 00041 R0 W1 L0 ) 10110000 : 00042 R0 W1 L0 ! 10110000 : Swapped length 2. 00043 R0 W1 L0 ) 01110000 : 00044 R0 W1 L0 / 01110000 : 00045 R0 W1 L0 [ 01110000 : 00046 R0 W1 L0 / 01111100 : 00047 R0 W1 L0 [ 01111100 : 00048 R0 W1 L0 ) 01111110 : 00049 R0 W1 L0 ! 01111110 : Swapped length 2. 0004A R0 W1 L0 ) 01111101 : 0004B R0 W1 L0 ! 01111101 : Swapped length 4. 0004C R0 W1 L0 ) 01110111 : 0004D R0 W1 L0 : 01110111 : w 0004E R0 W1 L0 [ 01110111 : 0004F R0 W1 L0 / 11110000 : 00050 R0 W1 L0 ( 11110000 : 00051 R0 W1 L0 [ 11110000 : 00052 R0 W1 L0 ) 11111000 : 00053 R0 W1 L0 ! 11111000 : Swapped length 2. 00054 R0 W1 L0 / 11110100 : 00055 R0 W1 L0 [ 11110100 : 00056 R0 W1 L0 ) 11110110 : 00057 R0 W1 L0 ) 11110110 : 00058 R0 W1 L0 ) 11110110 : 00059 R0 W1 L0 ! 11110110 : Swapped length 8. 0005A R0 W1 L0 : 01101111 : o 0005B R0 W1 L0 [ 01101111 : 0005C R0 W1 L0 ( 11110000 : 0005D R0 W1 L0 [ 11110000 : 0005E R0 W1 L0 ) 10110000 : 0005F R0 W1 L0 ! 10110000 : Swapped length 2. 00060 R0 W1 L0 ) 01110000 : 00061 R0 W1 L0 / 01110000 : 00062 R0 W1 L0 ( 01110000 : 00063 R0 W1 L0 / 01110000 : 00064 R0 W1 L0 [ 01110000 : 00065 R0 W1 L0 ) 01110010 : 00066 R0 W1 L0 ) 01110010 : 00067 R0 W1 L0 ) 01110010 : 00068 R0 W1 L0 : 01110010 : r 00069 R0 W1 L0 ( 01110010 : 0006A R0 W1 L0 ( 01110010 : 0006B R0 W1 L0 / 01110010 : 0006C R0 W1 L0 [ 01110010 : 0006D R0 W1 L0 ) 01100010 : 0006E R0 W1 L0 ) 01100010 : 0006F R0 W1 L0 / 01100010 : 00070 R0 W1 L0 [ 01100010 : 00071 R0 W1 L0 ) 01101100 : 00072 R0 W1 L0 ) 01101100 : 00073 R0 W1 L0 : 01101100 : l 00074 R0 W1 L0 ( 01101100 : 00075 R0 W1 L0 / 01101100 : 00076 R0 W1 L0 ( 01101100 : 00077 R0 W1 L0 [ 01101100 : 00078 R0 W1 L0 ) 01101000 : 00079 R0 W1 L0 ! 01101000 : Swapped length 2. 0007A R0 W1 L0 ) 01100100 : 0007B R0 W1 L0 ) 01100100 : 0007C R0 W1 L0 : 01100100 : d 0007D R0 W1 L0 ( 01100100 : 0007E R0 W1 L0 [ 01100100 : 0007F R0 W1 L0 [ 11000100 : 00080 R0 W1 L0 ) 10000100 : 00081 R0 W1 L0 ) 10000100 : 00082 R0 W1 L0 ! 10000100 : Swapped length 4. 00083 R0 W1 L0 / 00100100 : 00084 R0 W1 L0 [ 00100100 : 00085 R0 W1 L0 [ 00101100 : 00086 R0 W1 L0 ) 00101000 : 00087 R0 W1 L0 ! 00101000 : Swapped length 2. 00088 R0 W1 L0 ) 00100100 : 00089 R0 W1 L0 ! 00100100 : Swapped length 4. 0008A R0 W1 L0 ) 00100001 : 0008B R0 W1 L0 : 00100001 : ! 0008C R0 W1 L0 [ 00100001 : 0008D R0 W1 L0 [ 11110000 : 0008E R0 W1 L0 [ 11000000 : 0008F R0 W1 L0 ) 10000000 : 00090 R0 W1 L0 / 10000000 : 00091 R0 W1 L0 [ 10000000 : 00092 R0 W1 L0 ) 10100000 : 00093 R0 W1 L0 ) 10100000 : 00094 R0 W1 L0 ) 10100000 : 00095 R0 W1 L0 ! 10100000 : Swapped length 8. 00096 R0 W1 L0 : 00001010 :

00097 R0 W1 L0. 00001010 : 00098 R0 W1 L0. 00001010 : 00099 R0 W1 L0. 00001010 : 0009A R0 W1 L0. 00001010 : 0009B R0 W1 L0. 00001010 : 0009C R0 W1 L0. 00001010 : 0009D R0 W1 L0. 00001010 : 0009E R0 W1 L0. 00001010 : 0009F R0 W1 L0. 00001010 : 000A0 R0 W1 L0. 00001010 : 000A1 R0 W1 L0. 00001010 : 000A2 R0 W1 L0. 00001010 : 000A3 R0 W1 L0. 00001010 : 000A4 R0 W1 L0. 00001010 : 000A5 R0 W1 L0. 00001010 : 000A6 R0 W1 L0. 00001010 : 000A7 R0 W1 L0. 00001010 : 000A8 R0 W1 L0. 00001010 : 000A9 R0 W1 L0. 00001010 : 000AA R0 W1 L0. 00001010 : 000AB R0 W1 L0. 00001010 : 000AC R0 W1 L0. 00001010 : 000AD R0 W1 L0. 00001010 : 000AE R0 W1 L0. 00001010 : 000AF R0 W1 L0. 00001010 : 000B0 R0 W1 L0. 00001010 : 000B1 R0 W1 L0. 00001010 : 000B2 R0 W1 L0. 00001010 : 000B3 R0 W1 L0. 00001010 : 000B4 R0 W1 L0. 00001010 : 000B5 R0 W1 L0. 00001010 : 000B6 R0 W1 L0. 00001010 : 000B7 R0 W1 L0. 00001010 : 000B8 R0 W1 L0. 00001010 : 000B9 R0 W1 L0. 00001010 : 000BA R0 W1 L0. 00001010 : 000BB R0 W1 L0. 00001010 : 000BC R0 W1 L0. 00001010 : 000BD R0 W1 L0. 00001010 : 000BE R0 W1 L0. 00001010 : 000BF R0 W1 L0. 00001010 : 000C0 R0 W1 L0. 00001010 : 000C1 R0 W1 L0. 00001010 : 000C2 R0 W1 L0. 00001010 : 000C3 R0 W1 L0. 00001010 : 000C4 R0 W1 L0. 00001010 : 000C5 R0 W1 L0. 00001010 : 000C6 R0 W1 L0. 00001010 : 000C7 R0 W1 L0. 00001010 : 000C8 R0 W1 L0. 00001010 : 000C9 R0 W1 L0. 00001010 : 000CA R0 W1 L0. 00001010 : 000CB R0 W1 L0. 00001010 : 000CC R0 W1 L0. 00001010 : 000CD R0 W1 L0. 00001010 : 000CE R0 W1 L0. 00001010 : 000CF R0 W1 L0. 00001010 : 000D0 R0 W1 L0. 00001010 : 000D1 R0 W1 L0. 00001010 : 000D2 R0 W1 L0. 00001010 : 000D3 R0 W1 L0. 00001010 : 000D4 R0 W1 L0. 00001010 : 000D5 R0 W1 L0. 00001010 : 000D6 R0 W1 L0. 00001010 : 000D7 R0 W1 L0. 00001010 : 000D8 R0 W1 L0. 00001010 : 000D9 R0 W1 L0. 00001010 : 000DA R0 W1 L0. 00001010 : 000DB R0 W1 L0. 00001010 : 000DC R0 W1 L0. 00001010 : 000DD R0 W1 L0. 00001010 : 000DE R0 W1 L0. 00001010 : 000DF R0 W1 L0. 00001010 : 000E0 R0 W1 L0. 00001010 : 000E1 R0 W1 L0. 00001010 : 000E2 R0 W1 L0. 00001010 : 000E3 R0 W1 L0. 00001010 : 000E4 R0 W1 L0. 00001010 : 000E5 R0 W1 L0. 00001010 : 000E6 R0 W1 L0. 00001010 : 000E7 R0 W1 L0. 00001010 : 000E8 R0 W1 L0. 00001010 : 000E9 R0 W1 L0. 00001010 : 000EA R0 W1 L0. 00001010 : 000EB R0 W1 L0. 00001010 : 000EC R0 W1 L0. 00001010 : 000ED R0 W1 L0. 00001010 : 000EE R0 W1 L0. 00001010 : 000EF R0 W1 L0. 00001010 : 000F0 R0 W1 L0. 00001010 : 000F1 R0 W1 L0. 00001010 : 000F2 R0 W1 L0. 00001010 : 000F3 R0 W1 L0. 00001010 : 000F4 R0 W1 L0. 00001010 : 000F5 R0 W1 L0. 00001010 : 000F6 R0 W1 L0. 00001010 : 000F7 R0 W1 L0. 00001010 : 000F8 R0 W1 L0. 00001010 : 000F9 R0 W1 L0. 00001010 : 000FA R0 W1 L0. 00001010 : 000FB R0 W1 L0. 00001010 : 000FC R0 W1 L0. 00001010 : 000FD R0 W1 L0. 00001010 : 000FE R0 W1 L0. 00001010 : 000FF R0 W1 L0. 00001010 : Top-level program terminated. Freeing 128 bytes of data. Data freed.

External resources

 * C compiler and interpreter on Github - by User:Kaynato