Triliteral

From Esolang
Jump to navigation Jump to search
Triliteral / ثلاثي / תלת
Paradigm(s) imperative, literate, polyglossal, homoiconic, concatenative, low-level, thematic, self-modifying
Designed by User:Ecatmur
Appeared in 2022
Type system untyped
Dimensions one-dimensional
Computational class Turing complete
Reference implementation triliteral.py
Dialects Arabic, Hebrew, Latin
File extension(s) .tlt, .ثلث, .תלת

Have you ever wondered whether it'd be a good idea to have a language where every token encodes both the operation and operand? Triliteral answers that question with an emphatic NO.

Overview

In Semitic languages like Arabic and Hebrew, many words (verbs and nouns) are formed by applying a *stem* pattern of (mainly) vowels to a triconsanontal (triliteral) root. Triliteral takes this as inspiration, designating variables by consonants and operations by the vowels arranged around them.

Operations
Numeric Pattern Mnemonic Description
0 -K-T-B NOP (may be used for commenting)
1 aK-T-B ' load following word (e.g. aKTB B loads B to variable KTB)
2 uK-T-B CLR load empty word
3 iK-T-B WITH designate other operand for following instruction
4 -KaT-B LOAD from other operand
5 aKaT-B STORE to other
6 uKaT-B SWAP with other
7 iKaT-B CAT append other (also for addition, logical OR)
8 -KuT-B SUB other
9 aKuT-B MUL by other
10 uKuT-B DIV by other
11 iKuT-B MOD by other
12 -KiT-B HOP n words backwards
13 aKiT-B SKIP n words forwards
14 uKiT-B JUMP to address
15 iKiT-B LAND continuation; store pc (of next instruction)
16 -K-TaB > greater than (i.t.o gematria)
17 aK-TaB < less than
18 uK-TaB = equal to
19 iK-TaB != not equal to
20 -KaTaB INC
21 aKaTaB DEC
22 uKaTaB NOT (logical: 0 -> 1, all others -> 0)
23 iKaTaB AND (logical)
24 -KuTaB PEEK program memory
25 aKuTaB POKE program memory
26 uKuTaB read a decimal integer (using (Latin) "Arabic" numerals)
27 iKuTaB write a decimal integer
28 -KiTaB READ a word (spaces, punctuation discarded; 0 for EOF)
29 aKiTaB WRITE a word (0 writes a space)
30 uKiTaB read a Unicode character
31 iKiTaB write a Unicode character

Examples

Hello World!

Truth-machine

Cat program

וכיטאט יסכף אכאטט וסאכאף אכלט ק יכלט אסוכף אסיכף יכיטאט וסיכף
وكيطاط يسكض اكاطط وساكاض اكلط ق يكلط اسوكض اسيكض يكيطاط وسيكض

Google Translate thinks this says "And it's going to be quiet and it's going to stop".

99 bottles of beer

ﻲﻨﻴﻤﺑ  ﺎﺤﻨﺳ  ﺯ  ﻲﺤﻨﺳ  ﻲﻧﺎﻤﺑ ﺎﺴﻜﺿ ﻂﻟ ﺎﺴﻴﻜﺿ ﻲﺼﻃ ﺎﺑﺎﻄﻟ ﻮﻃﺎﺳﺎﻃ ﻮﻃﺎﺳﺎﻃ ﺎﺤﻨﺳ ﺯ ﻲﺤﻨﺳ ﺎﻃﻮﺴﻃ ﺎﻄﻴﺴﻃ ﺎﺤﻨﺳ ﺲﻴﺣ ﻲﺤﻴﻧﺎﺳ ﺎﺤﻨﺳ ﻖﻳﺍ ﻲﺤﻴﻧﺎﺳ ﻮﻨﻴﻣﺭ  ﻲﻨﻤﺳ  ﺎﺑﺎﻄﻟ  ﻲﻨﻤﺧ  ﺎﺑﺎﻄﻟ  ﺎﺤﻨﺳ ﻱ ﻲﺤﻨﺳ ﻮﻧﻮﻤﺳ ﻲﺤﻨﺳ ﻲﻧﻮﻤﺧ ﻲﺼﻃ ﺎﻧﺎﻤﺳ ﻮﻃﺎﺳﺎﻃ ﺎﺤﻨﺳ ﻢﺣ ﻲﺤﻨﺳ ﻲﻧﺎﻤﺳ ﺎﻄﻴﺴﻃ ﻲﻨﻴﻣﺎﺳ ﻲﺤﻨﺳ ﻲﻧﺎﻤﺧ
ﻲﻨﻴﻣﺎﺧ  ﻮﻨﻴﻣﺭ  ﻲﻄﻴﺴﻃ  ﺎﺤﻨﺳ  ﺯ ﻲﺤﻨﺳ ﻲﻃﺎﺴﻃ ﺎﺴﻜﺿ ﺰﻃ ﺎﺴﻴﻜﺿ ﻮﻄﺴﺳ ﻲﻄﻴﺴﻟ ﻲﻄﺴﺿ ﺎﻃﺎﺴﺳ ﻲﻄﺴﺳ ﻲﻃﺎﺴﺿ ﻁﻮﺳﺎﺿ ﻲﻄﻴﺳﺎﺿ ﻁﺎﺳﺎﺳ ﻲﺼﻃ ﺎﻃﺎﺴﺳ ﻲﻄﺳﺫ ﻮﺻﺎﻃ  ﺎﻄﻴﺴﻃ ﻮﻄﻴﺴﻟ ﻮﻄﻴﺳﺭ ﻲﺒﻴﺒﻟ ﺎﺤﻨﺳ ﺯ ﻲﺤﻨﺳ ﻲﺑﺎﺒﻟ ﺎﺴﻜﺿ ﻝﺯﺍ ﺎﺴﻴﻜﺿ ﻲﻨﻴﻣﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻧﺎﻣﺭ ﻮﻨﻴﻤﺑ ﺎﻄﺳﺫ ﺏﺩﺍ ﻲﻄﻴﺴﺳ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ
ﻲﻃﺎﺴﺳ  ﺎﻄﻴﺳﺫ  ﻞﺑ  ﺺﺣ  ﻖﻳﺍ  ﻖﻳﻭ  ﻖﻳﻭ ﻖﺣ ﻕﺍ ﻲﻄﻴﺳﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺳﺭ ﻮﻄﻴﺴﻃ ﻲﺼﻃ ﺎﺑﺎﻄﻟ ﺎﺤﻨﺳ ﺍ ﻲﺤﻨﺳ ﻮﺻﺎﻃ ﺎﺤﻨﺳ ﻮﻘﻃ ﺎﻄﻴﺴﻃ ﻲﺤﻴﻧﺎﺳ ﻮﺒﻴﺑﺭ  ﻲﺴﻳﺮﺳ  ﺎﺤﻨﺳ  ﺯ  ﻲﺤﻨﺳ ﻲﺳﺍﺮﺳ ﺎﺴﻜﺿ ﺎﺴﻗ ﺎﺴﻴﻜﺿ ﻲﺒﻴﺑﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﺑﺎﺑﺭ ﻮﺒﻴﺒﻟ ﺎﻄﺳﺫ ﻚﺑ ﻲﻄﻴﺴﺳ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺴﺳ ﺎﻄﻴﺳﺫ ﻞﺑ
ﻖﻳﺍ  ﻖﺑ  ﻞﺑ  ﺺﺣ  ﻕﺍ ﻕﺍ ﻖﻳﺩ ﻞﺑ ﻖﻳﺍ ﻖﻳ ﻞﺑ ﻖﻳﻭ ﻕﺩ ﻕﺍ ﻞﺑ ﻖﻴﻃ ﺹﺯ ﻖﺣ ﻖﺣ ﻡﺩ ﺎﻃ ﻲﻄﻴﺳﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺳﺭ ﻮﻄﻴﺴﻃ ﻲﺒﻴﺑﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﺑﺎﺑﺭ  ﻮﺒﻴﺒﻟ  ﺎﻄﺳﺫ  ﺎﻃ ﻲﻄﻴﺴﺳ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺴﺳ ﺎﻄﻴﺳﺫ ﻞﺑ ﻖﻳﺍ ﻖﺑ ﻞﺑ ﺺﺣ ﻕﺍ ﻕﺍ ﻖﻳﺩ ﻡﻭ ﺎﻃ ﻲﻄﻴﺳﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺳﺭ ﻮﻄﻴﺴﻃ ﺎﻄﺳﺫ
ﺎﻟ  ﻲﻄﻴﺴﺳ  ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺴﺳ ﺎﻄﻴﺳﺫ ﺪﻓ ﺰﻴﻓ ﺰﻗ ﺎﻗ ﻞﺑ ﺎﻴﻗ ﻲﻗ ﺎﻗ ﻞﺑ ﻕ ﺎﻴﻗ ﻂﻴﻗ ﻲﻗ ﺪﻴﻟ ﻞﺑ ﺐﻴﻗ ﺰﻴﻓ ﺍﺪﻴﻗ ﺍﺪﻴﻗ ﻞﺑ ﺍﺪﻗ ﺞﺠﻴﻗ ﻞﺑ ﺰﻴﻓ ﺪﻴﻗ  ﺎﻴﻗ  ﺰﻴﻗ  ﻲﻗ ﻕ ﻡﺩ ﺎﻃ ﻲﻄﻴﺳﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺳﺭ ﻮﻄﻴﺴﻃ ﺎﺑﺎﻃﺎﻟ ﻲﺒﻴﺑﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﺑﺎﺑﺭ ﻮﺒﻴﺒﻟ ﺎﻄﺳﺫ ﻚﺑ ﻲﻄﻴﺴﺳ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ
ﻲﻃﺎﺴﺳ  ﺎﻄﻴﺳﺫ  ﻞﺑ ﻖﻳﺍ ﻖﺑ ﻞﺑ ﺺﺣ ﻕﺍ ﻕﺍ ﻖﻳﺩ ﻞﺑ ﻖﻳﺍ ﻖﻳ ﻞﺑ ﻖﻳﻭ ﻕﺩ ﻕﺍ ﻞﺑ ﻖﻴﻃ ﺹﺯ ﻖﺣ ﻖﺣ ﻡﻭ ﺎﻃ ﻲﻄﻴﺳﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﻃﺎﺳﺭ ﻮﻄﻴﺴﻃ ﻮﺴﻳﺭﺭ ﺎﺒﻄﻟ ﺺﻃ ﻲﺴﻴﻃﺭ ﻲﺴﻳﺭﺭ ﺎﺤﻨﺳ ﺐﺟ ﻲﺤﻨﺳ ﻲﺳﺍﺭﺭ ﻮﺴﻳﺮﺳ ﻲﺼﻃ ﺎﺑﺎﻄﻟ ﻮﻃﺎﺳﺎﻃ ﺎﺤﻨﺳ ﺩ ﻲﺤﻨﺳ ﺎﻃﻮﺴﻃ ﺎﻄﻴﺴﻃ ﺎﺤﻨﺳ ﺎﻃ ﻲﺤﻴﻧﺎﺳ ﻮﺴﻴﻃﺭ

Microsoft Translate think the script says

The Fourth Imam, the Commander of the Faithful.
Male and female Male
The Commander of the Faithful, the Commander of the Faithful.
The Fourth Imam, the Commander of the Faithful
The Psalmist says, "Ye shall be a man of the Lord, and the Lord of the Worlds."
The Fourth Imam's Mission

Deadfish

Style guide

Writing in Arabic or Hebrew is preferred to Latin, but if you have to you can write in Latin and then transliterate.

When commenting with no-op (disemvowelled) words, remember that they contribute to instruction count for relative jumps. This can be useful for nop slides, though.

Annoyances

Triliteral is quite low-level, so defining functions and control flow etc. requires a lot of boilerplate to save program counter, count instructions for relative jumps, etc.

To write strings, you need to encode them into program text (as a sequence of Unicode codepoints), skip over them, then read them from program memory.

Accessing arbitrary amounts of memory requires either using bignum variables (in the Python implementation) or generating code to access arbitrary variables by building up instructions, writing them to program memory, and executing them.