IRC

IRC is a Turing complete programming language created by Smallhacker.

Description
IRC shares the format of IRC conversations on mIRC. It involves unvoiced (comments), voiced (variables) and ops (commands) talking to each other in one or more channels (threads).

Each program is divided into several files, one main file and then one for each channel.

Main file
The main file contains the name of the program, the name of the channels and the default error message, in that order. The format is as follows: /nick [name] /join [first_channel] /join [second_channel] ...etc... /join [last_channel] /quit [error_message]
 * [name] is the name of the program. The name follows the same restrictions as names on IRC. Must not be one of the reserved words.
 * [nth_channel] is the name of the nth channel in the program. The channel name follows the same restrictions as channel names on IRC (and must therefore be prefixed by #). The channel's code is stored in "[nth_channel].irc"
 * [error_message] is the error message shown if an error occurs (such as division by zero). This may be left empty.

Channels
A channel is where the chatting takes place. One can have multiple channels in the same program, allowing simple multi-threading. All channels are created when the program starts, meaning that creating channels during run-time isn't possible.

All channels must start with the following line: * [name] has joined [channel_name] Where [name] is the program name and [channel_name] is the name of the channel (same as file name).

To leave a channel (kill the thread), the following code is used: * [name] has left [channel_name]

The program runs until all channels has been left or the following code is used: * [name] has quit IRC (Quit: [error_message]) [error_message] is the error message that will be shown once the program has ended. (This may be left empty, causing no error message to appear)

Voiced
The voiced are the variables (signed integers) of IRC. They give themselves values and perform operations by talking.

Before a voiced can be used, it must enter the channel. This is done by the following line: * [voiced] has joined [channel_name] Where [voiced] is the name of the voiced (must not be the same as the program name or any reserved word), and [channel_name] is the name of the current channel. In the same way, a voiced may also leave the channel: * [voiced] has left [channel_name]

Now, to actually make them voiced, you must voice them: * [name] sets mode: +v [voiced] Where [name] is the name of the program.

A voiced can be in multiple channels at once. (The voiced are global, meaning that they have the same value in all channels.)

Here's the things a voiced can do: <[voiced]> I'm [value]. ([voiced] = [value]) <[voiced]> I'm not [value]. ([voiced] = ![value], bitwise NOT) <[voiced]> I'm [value] [operation] [value]. ([voiced] = [value] [operation] [value]) Where [voiced] is the name of the voiced being modified and [value] is a voiced or a number. The word "myself" may be used as one or more of the values to make it refer to itself.

Valid operations are: ("and", "or" and "xor" are bitwise)
 * plus
 * minus
 * times
 * divided by
 * to the power of
 * and
 * or
 * xor

Topics
Topics are the counterpart to labels. A topic is created with the following line: * [name] changes topic to '[topic]' Where [name] is the name of the program and [topic] is the name of the topic. Topics are not global, meaning that the same topic name may be used in more than one channel.

Ops
The ops are the ones that gets stuff done. There are four ops: Jump, If, Output and Input.

Jump
Changes to another topic (jumps to a label) or goes off topic (jumps to a subroutine).

Let's talk about [topic]. (Jumps to label [topic]) Off topic: Let's talk about [topic]. (Jumps to subroutine [topic]) They're talking about [topic] in [channel]. (Causes thread [channel] to jump to subroutine [topic].) Let's get back on topic. (Returns from subroutine)

If
Compares voices with other voices or numbers. If the condition is false, it skips the next line.

 [voiced], are you [condition]?

Valid conditions are: Where [value] is a voiced or a number.
 * equal to [value]
 * not equal to [value]
 * greater than [value]
 * less than [value]
 * equal to or greater than [value]
 * equal to or less than [value]

Output
Prints numbers or characters to the screen.

What's your value, [voiced]? (Outputs the value of the voiced) What's your character, [voiced]? (Outputs the ASCII character of the voiced)

Input
Input reads from the keyboard.

Hey, [voiced]. (Sets [voiced] to currently pressed key)

Unvoiced
Unvoiced are the counterparts to comments. They are created in the same way as voiced, except that the "* [name] sets mode: +v [voiced]" line is not used on them. The unvoiced's messages are ignored:

<[unvoiced]> This line will be ignored.

Reserved words
These words may not be used as the name of the program, voided or unvoiced:


 * jump
 * if
 * output
 * input
 * myself
 * not
 * or

To do
There's still some things left to be added to the language. Suggestions and comments are welcome in the Talk page.


 * Arrays
 * ...more?

Examples
Note: These has not been tested, as there's no interpreter.

Hello World
(helloworld.irc) /nick helloworld /join #world /quit "Something went wrong."

(world.irc) * helloworld has joined #world * temp has joined #world * l has joined #world * o has joined #world * helloworld sets mode: +v temp * helloworld sets mode: +v l * helloworld sets mode: +v o  I'm 108.  I'm 111. I'm 72. What's your character, temp? I'm 101. What's your character, temp? What's your character, l? What's your character, l? What's your character, o? I'm 32. What's your character, temp? I'm 87. What's your character, temp? What's your character, o? I'm 114. What's your character, temp? What's your character, l? I'm 100. What's your character, temp? * helloworld has quit IRC (Quit: )

External resources

 * an interpreter in php by User:Jeremysr
 * 99 bottles of beer