XOR

==Introduction==
XOR is an esoteric programing language that was created by User:Brain Boy 53.
XOR is inspired by FALSE, and just as FALSE is the creator's favorite truth value, XOR is the creator's favorite logic gate.
==Variables==
===Declaring Variables===
There are 3 types of variables; integers, characters, and strings.
To declare an integer, you type:
i|c|s"variable_name"
Ex:
 i"int"
This creates a variable integer calles "int"
To declare a character or string, you substitute the "i" with a "c" for characters, or an "s" for strings.
Something to note, variable names can't contain any whitespace, any of the following characters: " _ $ .
===Setting variable values===
To set a variable's value, you use a capital I for integers, capital C for characters, and a capital S for strings.
The syntax is:
I|C|S.variable_name.value_to_set_to_variable_to
The value of an integer is an integer, the value of a character is the ascii value of the character, and the value of a string is a string. Strings cannot contain any whitespace, or any of the following characters: " _ $ .
Ex:
 c"char" C.char.65
This declares and sets the variable "char" to the letter "A".
==Input/Output==
===Output===
To output a variable, you use the "p" command. The syntax is:
p_i|c|s_variable_name
Ex:
 s"hi" S.hi.Hello p_s_hi
This sets a string variable, "hi", sets it to the string, "Hello", and outputs it.
===Input===
To take input and store it is a variable, you do the same thing as output, but instead of "p", you write "u".
==Arithmetic and Logic==
To perform an operation, you type this:
a|b|m|v|d|n|r|x.first_variable.second_variable.third_variable
The result of the first variable operation second variable is stored into the third variable.
The operations are as follows:
 Operations
Letter in XOR	Name of operation	Symbol	Example	Result
a 	addition 	+ 	a.a.b.c	a+b
b 	subtraction 	- 	s.a.b.c	a-b
m 	multiplication 	* 	m.a.b.c	a*b
v 	division 	/ 	v.a.b.c	a/b
d 	modulo 	% 	d.a.b.c	a%b
n 	and 	& 	n.a.b.c	a&b
r 	or 	 	r.a.b.c	b
x 	xor 	^ 	x.a.b.c	a^b
There is also a not function that is used thusly:
t.first_variable.second_variable
If the first variable is a 0, the second variable gets set to 1, else, it gets set to 0.
==Flow Control==
There is only one way to have flow control, and that is using the "f" command.
The syntax for it is:
f$variable_one$variable_two$variable_three$variable_four
This checks to see if the first two variables are equal, and if they are, jump variable_three + 1 spaces forward, if not, jump variable_four + 1 spaces forward.
==Ending the program==
Type "e" to end the program.
This is not nessessary, but can be useful if you are using the "f" command.
==Example programs==
===Hello World===
 s"h" c"s" s"w" S.h.Hello, C.s.32 S.w.World! p_s_h p_c_s p_s_w
This makes three variables and outputs them in a row. Since XOR doesn't allow whitespace characters in strings, the space has to be stored as a character.
===Cat===
 s"t" u_s_t p_s_t
This makes a variable, asks the user for input, and outputs it.
===Parity===
 i"a" i"b" i"c" u_i_a I.b.2 d.a.b.c p_i_c
This outputs a 1 if the input is odd, and a 0 if the input is even.
===Adder===
 i"a" i"b" i"c" u_i_a u_i_b a.a.b.c p_i_c
This takes two inputs and add them and outputs the sum.
===Equality Checker===
 i"a" i"b" i"c" i"d" s"e" s"f" u_i_a u_i_b I.c.0 I.d.1 S.e.== S.f.!= f$a$b$c$d p_s_e f$a$b$d$c p_s_f e
This gets two inputs and outputs "==" if the inputs are equal, and "!=" if the outputs are different.
 i"a" i"b" i"c" i"d" s"e" s"f" u_i_a u_i_b I.c.0 I.d.2 S.e.== S.f.!= f$a$b$c$d p_s_e e p_s_f e
This is another variation making use of only one "f" command.
===Infinite Loop===
 i"a" i"b" I.a.1 I.b.-1 f$a$a$b$b
This gets the program stuck in an infinite loop.
===99 Bottles of Beer===
 i"bottles" I.bottles.99 i"0" I.0.0 i"b" I.b.-49 i"f" I.f.0 c"space" C.space.32 c"newline" C.newline.10 s"text1" S.text1.bottles s"text2" S.text2.of s"text3" S.text3.beer s"text4" S.text4.on s"text5" S.text5.the s"text6" S.text6.wall, s"text7" S.text7.beer! s"text8" S.text8.One s"text9" S.text9.fell s"text10" S.text10.down, s"text11" S.text11.pass s"text12" S.text12.it s"text13" S.text13.around, s"text14" S.text14.wall! i"1" I.1.1 p_i_bottles p_c_space p_s_text1 p_c_space p_s_text2 p_c_space p_s_text3 p_c_space p_s_text4 p_c_space p_s_text5 p_c_space p_s_text6 p_c_newline p_i_bottles p_c_space p_s_text1 p_c_space p_s_text2 p_c_space p_s_text7 p_c_newline p_s_text8 p_c_space p_s_text9 p_c_space p_s_text10 p_c_newline p_s_text11 p_c_space p_s_text12 p_c_space p_s_text13 p_c_newline b.bottles.1.bottles p_i_bottles p_c_space p_s_text1 p_c_space p_s_text2 p_c_space p_s_text3 p_c_space p_s_text4 p_c_space p_s_text5 p_c_space p_s_text14 f$bottles$0$f$b
(Retyped so you can see it:
i"bottles" I.bottles.99 i"0" I.0.0 i"b" I.b.-49 i"f" I.f.0 c"space" C.space.32 c"newline" C.newline.10 s"text1" S.text1.bottles s"text2" S.text2.of s"text3" S.text3.beer s"text4" S.text4.on s"text5" S.text5.the s"text6" S.text6.wall, s"text7" S.text7.beer! s"text8" S.text8.One s"text9" S.text9.fell s"text10" S.text10.down, s"text11" S.text11.pass s"text12" S.text12.it s"text13" S.text13.around, s"text14" S.text14.wall! i"1" I.1.1 p_i_bottles p_c_space p_s_text1 p_c_space p_s_text2 p_c_space p_s_text3 p_c_space p_s_text4 p_c_space p_s_text5 p_c_space p_s_text6 p_c_newline p_i_bottles p_c_space p_s_text1 p_c_space p_s_text2 p_c_space p_s_text7 p_c_newline p_s_text8 p_c_space p_s_text9 p_c_space p_s_text10 p_c_newline p_s_text11 p_c_space p_s_text12 p_c_space p_s_text13 p_c_newline b.bottles.1.bottles p_i_bottles p_c_space p_s_text1 p_c_space p_s_text2 p_c_space p_s_text3 p_c_space p_s_text4 p_c_space p_s_text5 p_c_space p_s_text14 f$bottles$0$f$b)
It does not work. And I do not know why.
==External Resources==
XOR interpreter on replit. (in python).
Category:Languages
Category:Implemented
Category:2024