Symbols

From Esolang
Jump to navigation Jump to search
The title of this article is not correct because of technical limitations. The correct title is actually ():;+-#?!.

():;#?! is a small esoteric language created by User:Lucasieks in November of 2013 with only 9 instructions.

Instruction Set

Instruction Action
( Start an infinite non-nestable loop
) End the infinite non-nestable loop
: Print the character to the right of the IP
; Read a character from STDIN, then overwrite the character 2 characters to the right of the IP
+ Increment the character to the right of the IP
- Decrement the character to the right of the IP
# Read a character from STDIN, then process it as an instruction
? End the program if the character to the left of the IP is a valid instruction
! End the program

Examples

Hello World

:H:e:l:l:o:,: :w:o:r:l:d:!

Cat

(;: )

Interpreters

Javascript

The interpreter takes in a program as input then outputs the program output.

function Symbols(P){
  P = P.split('');
  let o = '';
  for(let i = 0; i < P.length; i++){
    switch(P[i]){
      case ')': do{ i--; }while(P[i] != '('); break;
      case ':': o += P[i+1]; break;
      case ';': P[i] = prompt('Input Char')[0]; break;
      case '+': P[i+1] = String.fromCharCode(P[i+1].charCodeAt()+1); break;
      case '-': P[i+1] = String.fromCharCode(P[i+1].charCodeAt()-1); break;
      case '#':
        do{
          let h = prompt('Input Char');
          switch(h){
            case ')': do{i--;}while(P[i] != '('); break;
            case ':': o += P[i+1]; break;
            case ';': P[i] = prompt('Input Char')[0]; break;
            case '+': P[i+1] = String.fromCharCode(P[i+1].charCodeAt()+1); break;
            case '-': P[i+1] = String.fromCharCode(P[i+1].charCodeAt()-1); break;
            case '?': if('():;+-#?!'.includes(P[i-1])){i = P.length;} break;
            case '!': i = P.length;
          }
        }while(h == '#');
        break;
      case '?': if('():;+-#?!'.includes(P[i-1])){i = P.length;} break;
      case '!': i = P.length;
    }
  }
  return o;
}