We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

TSPARSE—MATMUL

From Esolang
Jump to navigation Jump to search

TSPARSE—MATMUL is an esolang created by User:Miui in which parse‑aware ternary matrix‑multiplication is the central operation.

Architecture

Programs are written as a 512×512 matrix of ternary weights in \{-1, 0, +1\}, where -1 is Nope., +1 is Nope! and 0 is noop. Interpretation requires a THCA and brainfuck.
Balanced ternary has 24 commands + 1 MODULO command.
Unbalanced ternary works best as a trivial brainfuck substition and has up to 11 commands.
The virtual memory one can achieve (computational power) is a complex dynamic between reduced brainfuck instruction sets and pagefile dimension, so 8 commands is suggested.

In the case of an 11 opcode unbalanced ternary architecture the 11th opcode has to be "multiply N times M%11 (mod11).

Stacks

There are 12 non-empty stacks. Stacks 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, b, e, f

stacks a,c,d and N compose a pagefile which allows reduced unbalanced brainfuck to access a memory array and perform operations on a stack.

commands

  • S MNEMONIC —S—
  1. 0 THALT —
  2. 1 TPUSH t → t
  3. 2 TADD a b → t
  4. 3 TMUL a b → t
  5. 4 TNEG t → t
  6. 5 TJMP__POS addr t → —
  7. 6 TJMP—ZERO addr t → —
  8. 7 TJMP_NEG addr t → —
  9. 8 TSTORE r t → —
  10. 9 TLOAD r → t
  11. b TJMP addr —
  12. e TCONS a b → t
  13. f TALLOC N M → t
  14. 0 TCALL addr → —
  15. 1 TRET → —
  16. 0 TMATMUL t t → t
  17. 1 TSPARSE—MATMUL t t → t
  18. 2 TIDX t i j → t
  19. 3 TSET t i j t → —
  20. 4 TSHAPE t → N M
  21. 5 TSPARSITY t → t
  22. 0 TSPAWN id → t
  23. 1 TSEND t t → —
  24. 2 TAWAIT t → t
  25. N MODULO MK

25 is an empty stack which simply takes the constant of the matrix operation and reduces to the weight of TSPARSE—MATMUL (t t → t) and duplicates the N derivatives of the M constant 1 time, yielding "11" which could be combination of two

TSPARSE—MATMUL
TSEND
TPUSH
TRET

and then multiplies it by 11.

See Also

Ternlang Whitepaper Influence for this language's creation.