Old page wikitext, before the edit (old_wikitext) | ''''3var''' is an [[esoteric programming language]] designed by [[User:LuaGeek2412]], with the goal of being as capable as other esolangs, but being much easier to make an interpreter for. It is heavily inspired by esolang [[Deadfish]].
Suggestions are welcome.
==Language Overview==
3var has - you guessed it - 3 variables! All of them store integers. 2 of the variables are called the accumulators, and the third is called the result. The accumulators will be referred to as A and B, and the result as R. 3var has quite a few commands, all of which are a single ASCII character to fulfill the goal of being easy to interpret.
These commands are:
<pre> i Increments A
d Decrements A
s Squares A
p Prints A
P Prints the ASCII character associated with A
x Sets A to the absolute value of A
> Sets A to R
a Increments B
k Decrements B
m Squares B
o Prints B
O Prints the ASCII character of B
0 Sets B to the absolute value of B
< Sets B to R
+ Adds A and B, stores in R
- Subtracts B from A, stores in R
* Multiplies A and B, stores in R
/ Divides A by B, stores in R
^ Exponentiates A to the Bth power, stores in R
w Prints R
u Marks a conditional which executes only if a>b
U Marks a conditional which executes only if a<b
= Marks a conditional which executes only if a==b
( Starts an if statement body
) Ends an if statement body
| Marks a loop which executes while a>b
_ Marks a loop which executes while a<b
\ Marks a loop which executes while a==b
f Marks a loop which executes a times
F Marks a loop which executes B times
{ Starts a loop which repeats forever
} Ends a loop which repeats forever
[ Starts a marked loop
] Ends a marked loop
' Takes a 1 character input from the user and stores the ASCII value of the character in R
" Takes a number input from the user and stores it in R
r Resets all variables to 0
@ Resets A to 0
# Rests B to 0
e Resets R to 0
$ Toggles comment
~ Starts a line comment
` Causes the interpreter to ignore the next character</pre>
All other characters throw errors, unless enclosed in a comment.
==Language Standards==
* Use of R as a full variable is discouraged, but allowed
* All variables can contain any number
==Computational Class==
3var is Turing-complete if and only if its variables are unbounded. Bounds on the variables are not specified and therefore implementation-dependent.<sup>[''Proof?'']</sup>
==Examples==
===[[Hello, world! | Hello, World!]]===
Legitimate Hello, World! with the exclamation point and everything.
<pre>iisssaa/>e
maa->e#
aamam->e#
dddddddddddddddddddddddddPiiiiiiiiiiiiiiiiiiiiiiiii
iiiiPiiiiiiiPPiiiP
r
iis
aamaaaa
*>P
r
iisssaa/>e
maa->e#
aamam->e#
iiiiiiiiiiiiiiiiiiiiiiP
ddddddddP
iiiP
ddddddP
ddddddddP
r
iiss
aa*>
iP</pre>
===[[Cat]]===
This one is shorter. I promise.
{'>P}
Don't ask me to make it accept multiple characters before outputting.
===Countdown===
An example of a marked loop.
Counts down from 100 to 1.
iiisis
|[
pd
]
The first line sets the starting value for A (100). It then sets B to the minimum value. Then, while a>b, it outputs a and decrements it.
===Parity===
Takes a number input and calculates if it is even or odd.
"> ~Take a number input and move it to a.
|[ ~While a>b do...
aa ~b+=2
]
=( ~if a==b...
riiisisi `1`0`1
P `e
r
)
U( ~if b>a...
riiisia+<*>i `1`1`1
P `o
r
)
Pretty self explanatory.
===Conditional Cat===
Copies input to output until a newline character is input.
i ~Set a to 1
|[ ~While a>0 do...
'<O ~Read in a character to b and output
@iiisi ~Set a to 10
->x ~Set a to |a-b|
# ~Set b back to zero for loop condition
]
==External resources==
*An [https://github.com/olls/3var-interpreter interpreter] written in C.
[[Category:Languages]]
[[Category:Implemented]]' |
New page wikitext, after the edit (new_wikitext) | ''''3var''' is an [[esoteric programming language]] designed by [[User:LuaGeek2412]], with the goal of being as capable as other esolangs, but being much easier to make an interpreter for. It is heavily inspired by esolang [[Deadfish]].
Suggestions are welcome.
==Language Overview==
3var has - you guessed it - 3 variables! All of them store integers. 2 of the variables are called the accumulators, and the third is called the result. The accumulators will be referred to as A and B, and the result as R. 3var has quite a few commands, all of which are a single ASCII character to fulfill the goal of being easy to interpret.
These commands are:
<pre> i Increments A
d Decrements A
s Squares A
p Prints A
P Prints the ASCII character associated with A
x Sets A to the absolute value of A
> Sets A to R
a Increments B
k Decrements B
m Squares B
o Prints B
O Prints the ASCII character of B
0 Sets B to the absolute value of B
< Sets B to R
+ Adds A and B, stores in R
- Subtracts B from A, stores in R
* Multiplies A and B, stores in R
/ Divides A by B, stores in R
^ Exponentiates A to the Bth power, stores in R
w Prints R
u Marks a conditional which executes only if a>b
U Marks a conditional which executes only if a<b
= Marks a conditional which executes only if a==b
( Starts an if statement body
) Ends an if statement body
| Marks a loop which executes while a>b
_ Marks a loop which executes while a<b
\ Marks a loop which executes while a==b
f Marks a loop which executes a times
F Marks a loop which executes B times
{ Starts a loop which repeats forever
} Ends a loop which repeats forever
[ Starts a marked loop
] Ends a marked loop
' Takes a 1 character input from the user and stores the ASCII value of the character in R
" Takes a number input from the user and stores it in R
r Resets all variables to 0
@ Resets A to 0
# Rests B to 0
e Resets R to 0
$ Toggles comment
~ Starts a line comment
` Causes the interpreter to ignore the next character</pre>
All other characters throw errors, unless enclosed in a comment.
==Language Standards==
* Use of R as a full variable is discouraged, but allowed
* All variables can contain any number
==Computational Class==
3var is Turing-complete if and only if its variables are unbounded. Bounds on the variables are not specified and therefore implementation-dependent.<sup>[''Proof?'']</sup>
==Examples==
===[[Hello, world! | Hello, World!]]===
Legitimate Hello, World! with the exclamation point and everything.
<pre>iisssaa/>e
maa->e#
aamam->e#
dddddddddddddddddddddddddPiiiiiiiiiiiiiiiiiiiiiiiii
iiiiPiiiiiiiPPiiiP
r
iis
aamaaaa
*>P
r
iisssaa/>e
maa->e#
aamam->e#
iiiiiiiiiiiiiiiiiiiiiiP
ddddddddP
iiiP
ddddddP
ddddddddP
r
iiss
aa*>
iP</pre>
===[[Cat]]===
This one is shorter. I promise.
{'>P}
Don't ask me to make it accept multiple characters before outputting.
===Countdown===
An example of a marked loop.
Counts down from 100 to 1.
iiisis
|[
pd
]
The first line sets the starting value for A (100). It then sets B to the minimum value. Then, while a>b, it outputs a and decrements it.
===Parity===
Takes a number input and calculates if it is even or odd.
"> ~Take a number input and move it to a.
|[ ~While a>b do...
aa ~b+=2
]
=( ~if a==b...
riiisisi `1`0`1
P `e
r
)
U( ~if b>a...
riiisia+<*>i `1`1`1
P `o
r
)
Pretty self explanatory.
===Conditional Cat===
Copies input to output until a newline character is input.
i ~Set a to 1
|[ ~While a>0 do...
'<O ~Read in a character to b and output
@iiisi ~Set a to 10
->x ~Set a to |a-b|
# ~Set b back to zero for loop condition
]
===99 Bottles of beer===
Prints 99 Bottles of beer in 3var
aaa m a m k
f
[
o
@ iii s s ddddd ddddd ddddd P
@ iii s ii s ddddd ddddd P
iiiii P P
ddddd ddd P
ddddd dd P
iiiii iiiii iiii P
@ iiiii i s dddd P
@iii s ii s ddddd ddddd P
ddddd dddd P
@ iiiii i s dddd P
iii s i s dd P
iii P P
iiiii iiiii iii P
@ iiiii i s dddd P
@ iii s ii s ddddd ddddd P
d P
@ iiiii i s dddd P
@ iii s ii s ddddd P
ddddd ddddd dd P
ddd P
@ iiiii i s dddd P
@ iii s ii s dd P
@ iii s i s ddd P
iiiii iiiii i P P
@ iiiii ii s ddddd P
@ iiii s ddd P
o
@ iii s i s dd P
@ iii s ii s ddddd ddddd P
iiiii P P
ddddd ddd P
ddddd dd P
iiiii iiiii iiii P
@ iiiii i s dddd P
@iii s ii s ddddd ddddd P
ddddd dddd P
@ iiiii i s dddd P
iii s i s dd P
iii P P
iiiii iiiii iii P
@ iiiii ii s ddd P
@ iiii s ddd P
@iii s i s ddddd ddddd ddddd d P
iiiii iiiii iii P
iiiii iiiii P
ddddd d P
@ iiiii i s dddd P
@iii s i s iiiii iiiii i P
d P
ddddd dddd P
@ iiiii i s dddd P
@iii s i s P
iiiii iiiii i P
iiiii iii P
ddddd dddd P
@ iiiii i s dddd P
iii s i s ddd P
iiiii iiiii iii P
ddddd ddddd P
@ iiiii i s dddd P
iiisi s iiiii iiiii ii P
@ iii s i s ddd P
@ iii s ii s ddddd d P P
@ iiiii i s dddd P
iii s i s iiiii P
iiiii iiiii i P
@ iiiii i s dddd P
@ iii s i s ddd P
@ iii s ii s ddddd dd P
ddd P
iiiii i P
ddddd dd P
ddddd ddddd P
@ iiiii ii s ddddd P
@ iiii s ddd P
k o
@ iii s s ddddd ddddd ddddd P
@ iii s ii s ddddd ddddd P
iiiii P P
ddddd ddd P
ddddd dd P
iiiii iiiii iiii P
@ iiiii i s dddd P
@iii s ii s ddddd ddddd P
ddddd dddd P
@ iiiii i s dddd P
iii s i s dd P
iii P P
iiiii iiiii iii P
@ iiiii i s dddd P
@ iii s ii s ddddd ddddd P
d P
@ iiiii i s dddd P
@ iii s ii s ddddd P
ddddd ddddd dd P
ddd P
@ iiiii i s dddd P
@ iii s ii s dd P
@ iii s i s ddd P
iiiii iiiii i P P
@ iiiii ii s ddd P
@ iiii s ddd P P
@ iii s i s dd
]
==External resources==
*An [https://github.com/olls/3var-interpreter interpreter] written in C.
[[Category:Languages]]
[[Category:Implemented]]' |
Lines added in edit (added_lines) | [
0 => ' ]',
1 => '',
2 => '===99 Bottles of beer===',
3 => 'Prints 99 Bottles of beer in 3var',
4 => ' aaa m a m k',
5 => ' f',
6 => ' [',
7 => ' o',
8 => ' ',
9 => ' @ iii s s ddddd ddddd ddddd P',
10 => ' @ iii s ii s ddddd ddddd P',
11 => ' iiiii P P',
12 => ' ddddd ddd P',
13 => ' ddddd dd P',
14 => ' iiiii iiiii iiii P',
15 => ' ',
16 => ' @ iiiii i s dddd P',
17 => ' ',
18 => ' @iii s ii s ddddd ddddd P',
19 => ' ddddd dddd P',
20 => ' ',
21 => ' @ iiiii i s dddd P',
22 => ' ',
23 => ' iii s i s dd P',
24 => ' iii P P',
25 => ' iiiii iiiii iii P',
26 => ' ',
27 => ' @ iiiii i s dddd P',
28 => ' ',
29 => ' @ iii s ii s ddddd ddddd P',
30 => ' d P',
31 => ' ',
32 => ' @ iiiii i s dddd P',
33 => ' ',
34 => ' @ iii s ii s ddddd P',
35 => ' ddddd ddddd dd P',
36 => ' ddd P',
37 => ' ',
38 => ' @ iiiii i s dddd P',
39 => ' ',
40 => ' @ iii s ii s dd P',
41 => ' @ iii s i s ddd P',
42 => ' iiiii iiiii i P P',
43 => ' ',
44 => ' @ iiiii ii s ddddd P',
45 => ' @ iiii s ddd P',
46 => ' o',
47 => ' @ iii s i s dd P',
48 => ' @ iii s ii s ddddd ddddd P',
49 => ' iiiii P P',
50 => ' ddddd ddd P',
51 => ' ddddd dd P',
52 => ' iiiii iiiii iiii P',
53 => ' ',
54 => ' @ iiiii i s dddd P',
55 => ' ',
56 => ' @iii s ii s ddddd ddddd P',
57 => ' ddddd dddd P',
58 => ' ',
59 => ' @ iiiii i s dddd P',
60 => ' ',
61 => ' iii s i s dd P',
62 => ' iii P P',
63 => ' iiiii iiiii iii P',
64 => ' ',
65 => ' @ iiiii ii s ddd P',
66 => ' ',
67 => ' @ iiii s ddd P',
68 => ' ',
69 => ' @iii s i s ddddd ddddd ddddd d P',
70 => ' iiiii iiiii iii P',
71 => ' iiiii iiiii P',
72 => ' ddddd d P',
73 => ' ',
74 => ' @ iiiii i s dddd P',
75 => ' ',
76 => ' @iii s i s iiiii iiiii i P',
77 => ' d P',
78 => ' ddddd dddd P',
79 => ' ',
80 => ' @ iiiii i s dddd P',
81 => ' ',
82 => ' @iii s i s P',
83 => ' iiiii iiiii i P',
84 => ' iiiii iii P',
85 => ' ddddd dddd P',
86 => ' ',
87 => ' @ iiiii i s dddd P',
88 => ' ',
89 => ' iii s i s ddd P',
90 => ' iiiii iiiii iii P',
91 => ' ddddd ddddd P',
92 => ' ',
93 => ' @ iiiii i s dddd P',
94 => ' ',
95 => ' iiisi s iiiii iiiii ii P',
96 => ' @ iii s i s ddd P',
97 => ' @ iii s ii s ddddd d P P',
98 => ' ',
99 => ' @ iiiii i s dddd P',
100 => ' ',
101 => ' iii s i s iiiii P',
102 => ' iiiii iiiii i P',
103 => ' ',
104 => ' @ iiiii i s dddd P',
105 => ' ',
106 => ' @ iii s i s ddd P',
107 => ' @ iii s ii s ddddd dd P',
108 => ' ddd P',
109 => ' iiiii i P',
110 => ' ddddd dd P',
111 => ' ddddd ddddd P',
112 => ' ',
113 => ' @ iiiii ii s ddddd P',
114 => ' ',
115 => ' @ iiii s ddd P',
116 => ' ',
117 => ' k o',
118 => ' @ iii s s ddddd ddddd ddddd P',
119 => ' @ iii s ii s ddddd ddddd P',
120 => ' iiiii P P',
121 => ' ddddd ddd P',
122 => ' ddddd dd P',
123 => ' iiiii iiiii iiii P',
124 => ' ',
125 => ' @ iiiii i s dddd P',
126 => ' ',
127 => ' @iii s ii s ddddd ddddd P',
128 => ' ddddd dddd P',
129 => ' ',
130 => ' @ iiiii i s dddd P',
131 => ' ',
132 => ' iii s i s dd P',
133 => ' iii P P',
134 => ' iiiii iiiii iii P',
135 => ' ',
136 => ' @ iiiii i s dddd P',
137 => ' ',
138 => ' @ iii s ii s ddddd ddddd P',
139 => ' d P',
140 => ' ',
141 => ' @ iiiii i s dddd P',
142 => ' ',
143 => ' @ iii s ii s ddddd P',
144 => ' ddddd ddddd dd P',
145 => ' ddd P',
146 => ' ',
147 => ' @ iiiii i s dddd P',
148 => ' ',
149 => ' @ iii s ii s dd P',
150 => ' @ iii s i s ddd P',
151 => ' iiiii iiiii i P P',
152 => ' ',
153 => ' @ iiiii ii s ddd P',
154 => ' ',
155 => ' @ iiii s ddd P P',
156 => ' @ iii s i s dd'
] |