ISCOM

ISCOM is an esoteric programming language made by User:iconmaster that stands for Iconmaster's Shameless Clone Of Migol. Needless to say, this language is a close derivative of Migol. Its goal is to be like Migol, but make more dense code.
== Memory and numbers ==
ISCOM has an array of memory cells going forever in one direction. Each cell holds one integer value. Cells start at index 0.
Memory cells can be dereferenced by placing [] around the number. Dereferences may be nested arbitrarily. Negative numbers are expressed by placing an _ in front of them. There are three 'special' numbers, #, @, and $, which will be discussed later.
== Language description ==
The code consists of a space-separated series of commands, which are divided into 3 parts—assignments, operations, and conditionals.
=== Assignments ===
These are in this form:
 a=b
where a and b are any number. Cell a is set to b.
=== Operations ===
These are of this form:
 a=xb
where a and b are numbers, and x is an operator. They set a to a x b. Valid operators are:
Symbol	Operator meaning
+ 	addition
- 	subtraction
* 	multiplication
/ 	division, round down
% 	modulus
& 	bitwise and
 	bitwise or
^ 	bitwise xor
: 	bitwise not
! 	logical not
= 	equality
~ 	inequality
< 	less-than
> 	greater-than
{ 	left rotate
} 	right rotate
The last part can be chained, like this:
 a=xbxcxd...
Here x is applied to the result of each previous operation.
=== Conditionals ===
These are of this form:
 ?axb
where a and b are numbers, and x is one of the above operators. If the result of a x b is zero, the next command is skipped.
== Flow control ==
The 'special' number # represents the instruction pointer. Set it to change where the IP is.
== I/O ==
The number @ represents the I/O stream. The number $ represents the current I/O port.
Set @ to display output, and get the value of @ to get input.
Use $ to get and set the current I/O port. Here is the preinstalled port list:
Port no.	Description
0 	Inputs and outputs to the console as characters.
1 	Inputs and outputs to the console as numbers.
2 	Filename specifier. Send characters to build the name of the file to open. Send a newline to clear the buffer.
3 	File seeking. Send the number of where you want to seek. Get its value to find where you are in the file.
4 	Writes and reads to the file as characters. Returns -1 on EOF.
5 	Writes and reads to the file as numbers. Returns -1 on EOF.
6 	Socket type. Set to 0 to close the open socket, if it exists. Set to 1 to be a socket client, or 2 to be a server socket. Be sure to set port 7 and 8 beforehand.
7 	Socket Address. Send characters to build the IP adress of the socket. Send a newline to clear the buffer.
8 	Socket Port. Use this to set the port of the socket.
9 	Socket I/O. Use this to receive/send data from the socket. Returns -1 on error. When sending data, send -1 to flush the data buffer and send it.
10 	Sleeper. Send the amount of seconds to sleep.
11 	Random number generator. Set it to a value, and access it to get a random number between 1 and the set value.
== Superfluous features ==
* To help with output, any character after a ' is translated to its character value.
* All characters between double quotes will be put into output, as by the translation "abc" -> @='a @='b @='c.
* Anything within () is ignored. This is effectively a comment system.
* Labels: Any word starting with ;; is a label. If you state #=LABEL and state ;;LABEL, the program will jump to the instruction after ;;LABEL.
* Constants: Any word starting with ;; and having an = in it is a named constant. A reference to it will return the value specified, so that ;;A=100 @=A will print d.
== The ISCOM Interpreter ==
Found here is the official ISCOM interpreter. This Lua script has several command-line options. It accepts ISCOM code directly from the command line. If no code is provided, it allows you to enter code interactively.
=== Options ===
* -f file: This option makes ISCOM get its input from a specified file, rather than the arguments itself.
* -d: Enters debug mode (see below).
=== Debug Mode ===
Debug mode allows you to debug code interactively. Each command to the debug console is one letter long, and may also take arguments.
==== Commands ====
Letter 	Name 	Arguments 	Description
memory location 	Get Memory 	n/a 	Prints the contents of the memory at that location.
two memory locations	Get Memory Array	n/a 	Prints the contents of the memory between the two locations.
Operator 	Do Operation 	n1 n2 	Prints the result of doing the specified operation on the two numbers n1 and n2.
r 	Registers 	n/a 	Prints the contents of the IP, the port, and any tracked variables.
j 	Jump 	location 	Sets # to the specified location.
p 	Port 	port 	Sets $ to the specified port.
s 	Set Memory 	loc value 	Sets the memory location at loc to value.
l 	List Program 	[begin end] 	Prints all the commands in the program. If begin is specified, prints the command at begin. If both arguments are specified, prints all the commands in between.
c 	Constant 	[const value]	If no arguments, prints all the constants. If const is specified, prints the value of const. If both arguments are specified, sets const to value.
g 	Go 	[break] 	Runs the program until the breakpoint at break is reached. If break is not specified, runs through all the program.
q 	Quit 	n/a 	Exits the ISCOM interpreter.
b 	Blank state 	n/a 	Resets the state of the ISCOM program to the beginning.
v 	Verbose 	n/a 	Toggles Verbose Mode. Verbose mode prints tracking data every step ran.
t 	Track 	label mem 	Begins tracking of the memory location at mem, given a text prefix of label. If mem is not specified, clears the track called by label. If no arguments specified, clears all locations being tracked.
== Examples ==
=== Cat ===
 @=@ #=1
=== Counts up forever ===
 $=1 ;;LOOP 0=+1 @=[0] $=0 @=10 $=1 #=LOOP
=== Hello world ===
 "Hello, world!" @=10
=== 99 bottles of beer ===
 0=99 ;;LOOP
 $=1 @=[0] $=0 " bottles of beer on the wall," @=10
 $=1 @=[0] $=0 " bottles of beer." @=10
 "You take one down, pass it around," @=10 0=-1
 $=1 @=[0] $=0 " bottles of beer on the wall!" @=10
 ?[0]~0 #=LOOP
=== File writing ===
Writes "Hello, files!" to the file hello.txt.
 $=2 "hello.txt" $=4 "Hello, files!"
=== Socket writing ===
Sends "From ISCOM Server!" to client forever, using localhost.
Client:
 $=7 "127.0.0.1" $=8 @=1337 $=0 0=@ $=6 @=1 ;;LOOP $=9 0=@ $=0 @=[0] #=LOOP
Server:
 $=7 "127.0.0.1" $=8 @=1337 $=6 @=2 $=9 ;;LOOP "From ISCOM Server!" @=10 @=_1 #=LOOP
== See Also ==
* User:iconmaster/iscom.lua is a Lua interpreter for ISCOM.
* Migol, ISCOM's inspiration.
Category:2011Category:ImplementedCategory:Turing completeCategory:Low-levelCategory:Cell-based