New page wikitext, after the edit (new_wikitext) | '{{infobox proglang
|name=Tonnyi
|paradigms=Imperative
|author=[[User:Hasin Israk Toaha|Hasin Israk Toaha]]
|year=2025
|class=[[:Category:Turing complete|Turing complete]]
|files=<code>.ton</code>
}}
'''Tonnyi''' is an esoteric programming language and educational interpreter created by [[User:Hasin Israk Toaha|Hasin Israk Toaha]] in 2025. The language is characterized by its use of pure binary opcodes for all instructions and [[Java]]-based implementation that uses <code>BigDecimal</code> for high-precision arithmetic operations.
==Overview==
Tonnyi is an assembly-like language where all instructions are written using their 7-bit binary opcode strings (<code>0b0001010</code>). The language features 44 implemented instructions out of 128 possible opcodes, with operations including memory manipulation, arithmetic, bitwise operations, control flow, and I/O.
The interpreter simulates a 64KB memory space addressable with 4-digit hexadecimal values (<code>0x0000</code> to <code>0xFFFF</code>) and supports both integer and floating-point operations with arbitrary precision.
==Language Specification==
===Memory Model===
* '''Memory Space''': 64KB addressable memory (<code>0x0000</code> to <code>0xFFFF</code>)
* '''Addressing''': 4-digit hexadecimal values (e.g., <code>0x001A</code>, <code>0xFFFF</code>)
* '''Immediate Values''': Prefixed with <code>#</code> (e.g., <code>#100</code>, <code>#3.14159</code>, <code>#-42</code>)
===Syntax===
Programs are written in text files with <code>.ton</code> extension. The basic syntax consists of:
* '''Instructions''': <code>BINARY_OPCODE operand1 operand2</code>
* '''Labels''': Defined on their own line ending with colon (<code>:</code>)
* '''Comments''': Start with <code>//</code>
Example instruction: <code>0b0001010 0x002A 0x002B</code> (Add values at addresses)
===Instruction Set===
Tonnyi implements 44 instructions across several categories:
====System Operations====
* <code>0b0000000</code> - HALT: Stops program execution
* <code>0b0000001</code> - NOP: No operation
* <code>0b0000010</code> - DUMP MEMORY: Prints all non-zero memory values (debug mode only)
====Memory Operations====
* <code>0b0000011</code> - PRINT: Prints value at address
* <code>0b0000100</code> - LOAD IMMEDIATE: Loads immediate value into destination
* <code>0b0000101</code> - LOAD FROM MEMORY: Copies value from source to destination
* <code>0b0000110</code> - MOV: Alias for LOAD FROM MEMORY
* <code>0b0000111</code> - STORE: Alias for LOAD FROM MEMORY
* <code>0b0001000</code> - SWAP: Swaps values at two addresses
* <code>0b0001001</code> - CLEAR: Sets address to zero
====Arithmetic Operations====
* <code>0b0001010</code> - ADD: <code>dest = dest + src</code>
* <code>0b0001011</code> - SUBTRACT: <code>dest = dest - src</code>
* <code>0b0001100</code> - MULTIPLY: <code>dest = dest × src</code>
* <code>0b0001101</code> - DIVIDE: <code>dest = dest ÷ src</code>
* <code>0b0001110</code> - MODULO: <code>dest = dest % src</code>
* <code>0b0001111</code> - INCREMENT: <code>addr = addr + 1</code>
* <code>0b0010000</code> - DECREMENT: <code>addr = addr - 1</code>
* <code>0b0010001</code> - POWER: <code>dest = dest ^ src</code>
* <code>0b0010010</code> - NEGATE: <code>addr = -addr</code>
* <code>0b0010011</code> - ABSOLUTE: <code>addr = |addr|</code>
====Bitwise Operations====
* <code>0b0010100</code> - AND: Bitwise AND
* <code>0b0010101</code> - OR: Bitwise OR
* <code>0b0010110</code> - XOR: Bitwise XOR
* <code>0b0010111</code> - NOT: Bitwise NOT
* <code>0b0011000</code> - SHIFT LEFT: Left shift
* <code>0b0011001</code> - SHIFT RIGHT: Right shift (arithmetic)
====Comparison & Control Flow====
* <code>0b0011010</code> - COMPARE: Compares two values, sets internal flag
* <code>0b0011011</code> - JUMP: Unconditional jump to label
* <code>0b0011100</code> - JUMP IF ZERO: Jump if comparison result == 0
* <code>0b0011101</code> - JUMP IF NOT ZERO: Jump if comparison result != 0
* <code>0b0011110</code> - JUMP IF EQUAL: Jump if comparison result == 0
* <code>0b0011111</code> - JUMP IF NOT EQUAL: Jump if comparison result != 0
* <code>0b0100000</code> - JUMP IF GREATER: Jump if comparison result > 0
* <code>0b0100001</code> - JUMP IF LESS: Jump if comparison result < 0
* <code>0b0100010</code> - CALL: Push current PC and jump to subroutine
* <code>0b0100011</code> - RETURN: Pop return address and return from subroutine
====Stack Operations====
* <code>0b0100100</code> - PUSH: Push value onto call stack
* <code>0b0100101</code> - POP: Pop value from call stack
====I/O Operations====
* <code>0b0100110</code> - INPUT: Read number from stdin into address
* <code>0b0100111</code> - PRINT CHAR: Print value as ASCII character
* <code>0b0101000</code> - PRINT STRING: Print null-terminated string
====Special Operations====
* <code>0b0101001</code> - RANDOM: Store random number (0-100) in address
====Debug Operations====
* <code>0b0101010</code> - DEBUG MODE ON: Enable verbose debug output
* <code>0b0101011</code> - DEBUG MODE OFF: Disable verbose debug output
==Examples==
===Hello World===
<pre>
// Load immediate values for 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'
0b0000100 0x1000 #72 // 'H'
0b0000100 0x1001 #101 // 'e'
0b0000100 0x1002 #108 // 'l'
0b0000100 0x1003 #108 // 'l'
0b0000100 0x1004 #111 // 'o'
0b0000100 0x1005 #32 // ' '
0b0000100 0x1006 #87 // 'W'
0b0000100 0x1007 #111 // 'o'
0b0000100 0x1008 #114 // 'r'
0b0000100 0x1009 #108 // 'l'
0b0000100 0x100A #100 // 'd'
0b0000100 0x100B #33 // '!'
0b0000100 0x100C #0 // Null terminator
// Print the string starting at address 0x1000
0b0101000 0x1000
// Halt the program
0b0000000
</pre>
===Addition Program===
<pre>
// Read two numbers and print their sum
0b0100110 0x2000 // INPUT first number
0b0100110 0x2001 // INPUT second number
0b0000101 0x2002 0x2000 // COPY first number
0b0001010 0x2002 0x2001 // ADD second number
0b0000011 0x2002 // PRINT result
0b0000000 // HALT
</pre>
==Implementation==
The Tonnyi interpreter is implemented in Java and uses <code>BigDecimal</code> for all arithmetic operations, providing high-precision calculations. The interpreter performs two passes over the source code: first to collect labels, and second to execute instructions.
==Computational Class==
Though not formally proven, Tonnyi appears to be [[Turing complete]] as it supports:
* Conditional jumps
* Unbounded memory (within 64KB simulation)
* Subroutine calls with a stack
* Arbitrary memory manipulation
==External Resources==
* [https://github.com/toaha63/Tonnyi GitHub repository]
[[Category:Languages]]
[[Category:Implemented]]
[[Category:2025]]
[[Category:Imperative paradigm]]
[[Category:Low-level]]
[[Category:Cell-based]]
[[Category:Deterministic]]
[[Category:Usable]]
[[Category:Turing complete]]
[[Category:Text based]]
[[Category:Educational languages]]' |
Lines added in edit (added_lines) | [
0 => '{{infobox proglang',
1 => '|name=Tonnyi',
2 => '|paradigms=Imperative',
3 => '|author=[[User:Hasin Israk Toaha|Hasin Israk Toaha]]',
4 => '|year=2025',
5 => '|class=[[:Category:Turing complete|Turing complete]]',
6 => '|files=<code>.ton</code>',
7 => '}}',
8 => '',
9 => ''''Tonnyi''' is an esoteric programming language and educational interpreter created by [[User:Hasin Israk Toaha|Hasin Israk Toaha]] in 2025. The language is characterized by its use of pure binary opcodes for all instructions and [[Java]]-based implementation that uses <code>BigDecimal</code> for high-precision arithmetic operations.',
10 => '',
11 => '==Overview==',
12 => 'Tonnyi is an assembly-like language where all instructions are written using their 7-bit binary opcode strings (<code>0b0001010</code>). The language features 44 implemented instructions out of 128 possible opcodes, with operations including memory manipulation, arithmetic, bitwise operations, control flow, and I/O.',
13 => '',
14 => 'The interpreter simulates a 64KB memory space addressable with 4-digit hexadecimal values (<code>0x0000</code> to <code>0xFFFF</code>) and supports both integer and floating-point operations with arbitrary precision.',
15 => '',
16 => '==Language Specification==',
17 => '',
18 => '===Memory Model===',
19 => '* '''Memory Space''': 64KB addressable memory (<code>0x0000</code> to <code>0xFFFF</code>)',
20 => '* '''Addressing''': 4-digit hexadecimal values (e.g., <code>0x001A</code>, <code>0xFFFF</code>)',
21 => '* '''Immediate Values''': Prefixed with <code>#</code> (e.g., <code>#100</code>, <code>#3.14159</code>, <code>#-42</code>)',
22 => '',
23 => '===Syntax===',
24 => 'Programs are written in text files with <code>.ton</code> extension. The basic syntax consists of:',
25 => '',
26 => '* '''Instructions''': <code>BINARY_OPCODE operand1 operand2</code>',
27 => '* '''Labels''': Defined on their own line ending with colon (<code>:</code>)',
28 => '* '''Comments''': Start with <code>//</code>',
29 => '',
30 => 'Example instruction: <code>0b0001010 0x002A 0x002B</code> (Add values at addresses)',
31 => '',
32 => '===Instruction Set===',
33 => 'Tonnyi implements 44 instructions across several categories:',
34 => '',
35 => '====System Operations====',
36 => '* <code>0b0000000</code> - HALT: Stops program execution',
37 => '* <code>0b0000001</code> - NOP: No operation',
38 => '* <code>0b0000010</code> - DUMP MEMORY: Prints all non-zero memory values (debug mode only)',
39 => '',
40 => '====Memory Operations====',
41 => '* <code>0b0000011</code> - PRINT: Prints value at address',
42 => '* <code>0b0000100</code> - LOAD IMMEDIATE: Loads immediate value into destination',
43 => '* <code>0b0000101</code> - LOAD FROM MEMORY: Copies value from source to destination',
44 => '* <code>0b0000110</code> - MOV: Alias for LOAD FROM MEMORY',
45 => '* <code>0b0000111</code> - STORE: Alias for LOAD FROM MEMORY',
46 => '* <code>0b0001000</code> - SWAP: Swaps values at two addresses',
47 => '* <code>0b0001001</code> - CLEAR: Sets address to zero',
48 => '',
49 => '====Arithmetic Operations====',
50 => '* <code>0b0001010</code> - ADD: <code>dest = dest + src</code>',
51 => '* <code>0b0001011</code> - SUBTRACT: <code>dest = dest - src</code>',
52 => '* <code>0b0001100</code> - MULTIPLY: <code>dest = dest × src</code>',
53 => '* <code>0b0001101</code> - DIVIDE: <code>dest = dest ÷ src</code>',
54 => '* <code>0b0001110</code> - MODULO: <code>dest = dest % src</code>',
55 => '* <code>0b0001111</code> - INCREMENT: <code>addr = addr + 1</code>',
56 => '* <code>0b0010000</code> - DECREMENT: <code>addr = addr - 1</code>',
57 => '* <code>0b0010001</code> - POWER: <code>dest = dest ^ src</code>',
58 => '* <code>0b0010010</code> - NEGATE: <code>addr = -addr</code>',
59 => '* <code>0b0010011</code> - ABSOLUTE: <code>addr = |addr|</code>',
60 => '',
61 => '====Bitwise Operations====',
62 => '* <code>0b0010100</code> - AND: Bitwise AND',
63 => '* <code>0b0010101</code> - OR: Bitwise OR',
64 => '* <code>0b0010110</code> - XOR: Bitwise XOR',
65 => '* <code>0b0010111</code> - NOT: Bitwise NOT',
66 => '* <code>0b0011000</code> - SHIFT LEFT: Left shift',
67 => '* <code>0b0011001</code> - SHIFT RIGHT: Right shift (arithmetic)',
68 => '',
69 => '====Comparison & Control Flow====',
70 => '* <code>0b0011010</code> - COMPARE: Compares two values, sets internal flag',
71 => '* <code>0b0011011</code> - JUMP: Unconditional jump to label',
72 => '* <code>0b0011100</code> - JUMP IF ZERO: Jump if comparison result == 0',
73 => '* <code>0b0011101</code> - JUMP IF NOT ZERO: Jump if comparison result != 0',
74 => '* <code>0b0011110</code> - JUMP IF EQUAL: Jump if comparison result == 0',
75 => '* <code>0b0011111</code> - JUMP IF NOT EQUAL: Jump if comparison result != 0',
76 => '* <code>0b0100000</code> - JUMP IF GREATER: Jump if comparison result > 0',
77 => '* <code>0b0100001</code> - JUMP IF LESS: Jump if comparison result < 0',
78 => '* <code>0b0100010</code> - CALL: Push current PC and jump to subroutine',
79 => '* <code>0b0100011</code> - RETURN: Pop return address and return from subroutine',
80 => '',
81 => '====Stack Operations====',
82 => '* <code>0b0100100</code> - PUSH: Push value onto call stack',
83 => '* <code>0b0100101</code> - POP: Pop value from call stack',
84 => '',
85 => '====I/O Operations====',
86 => '* <code>0b0100110</code> - INPUT: Read number from stdin into address',
87 => '* <code>0b0100111</code> - PRINT CHAR: Print value as ASCII character',
88 => '* <code>0b0101000</code> - PRINT STRING: Print null-terminated string',
89 => '',
90 => '====Special Operations====',
91 => '* <code>0b0101001</code> - RANDOM: Store random number (0-100) in address',
92 => '',
93 => '====Debug Operations====',
94 => '* <code>0b0101010</code> - DEBUG MODE ON: Enable verbose debug output',
95 => '* <code>0b0101011</code> - DEBUG MODE OFF: Disable verbose debug output',
96 => '',
97 => '==Examples==',
98 => '',
99 => '===Hello World===',
100 => '<pre>',
101 => '// Load immediate values for 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'',
102 => '0b0000100 0x1000 #72 // 'H'',
103 => '0b0000100 0x1001 #101 // 'e'',
104 => '0b0000100 0x1002 #108 // 'l'',
105 => '0b0000100 0x1003 #108 // 'l'',
106 => '0b0000100 0x1004 #111 // 'o'',
107 => '0b0000100 0x1005 #32 // ' '',
108 => '0b0000100 0x1006 #87 // 'W'',
109 => '0b0000100 0x1007 #111 // 'o'',
110 => '0b0000100 0x1008 #114 // 'r'',
111 => '0b0000100 0x1009 #108 // 'l'',
112 => '0b0000100 0x100A #100 // 'd'',
113 => '0b0000100 0x100B #33 // '!'',
114 => '0b0000100 0x100C #0 // Null terminator',
115 => '',
116 => '// Print the string starting at address 0x1000',
117 => '0b0101000 0x1000',
118 => '',
119 => '// Halt the program',
120 => '0b0000000',
121 => '</pre>',
122 => '',
123 => '===Addition Program===',
124 => '<pre>',
125 => '// Read two numbers and print their sum',
126 => '0b0100110 0x2000 // INPUT first number',
127 => '0b0100110 0x2001 // INPUT second number',
128 => '0b0000101 0x2002 0x2000 // COPY first number',
129 => '0b0001010 0x2002 0x2001 // ADD second number',
130 => '0b0000011 0x2002 // PRINT result',
131 => '0b0000000 // HALT',
132 => '</pre>',
133 => '',
134 => '==Implementation==',
135 => 'The Tonnyi interpreter is implemented in Java and uses <code>BigDecimal</code> for all arithmetic operations, providing high-precision calculations. The interpreter performs two passes over the source code: first to collect labels, and second to execute instructions.',
136 => '',
137 => '==Computational Class==',
138 => 'Though not formally proven, Tonnyi appears to be [[Turing complete]] as it supports:',
139 => '* Conditional jumps',
140 => '* Unbounded memory (within 64KB simulation)',
141 => '* Subroutine calls with a stack',
142 => '* Arbitrary memory manipulation',
143 => '',
144 => '==External Resources==',
145 => '* [https://github.com/toaha63/Tonnyi GitHub repository]',
146 => '',
147 => '[[Category:Languages]]',
148 => '[[Category:Implemented]]',
149 => '[[Category:2025]]',
150 => '[[Category:Imperative paradigm]]',
151 => '[[Category:Low-level]]',
152 => '[[Category:Cell-based]]',
153 => '[[Category:Deterministic]]',
154 => '[[Category:Usable]]',
155 => '[[Category:Turing complete]]',
156 => '[[Category:Text based]]',
157 => '[[Category:Educational languages]]'
] |