User:Feuermonster

From Esolang

Jump to: navigation, search

Contents

[edit] About

Yeah, that's me. I started to get fascinated by esolangs as I seen Brainfuck on wikipedia. Then I'll clicked on the link to this wiki, and look at some languages. Then, I wanted to create my own languages. First, I wrote my interpreters in VB.Net, but now, i('ll)try to write them in python.

[edit] Others

Things invented by me:

[edit] C++-BF

BF-Interpreter in C++.

#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <ctype>
#include <iostream>
#include <cctype>
#include <vector>
#include "conio.h"
#include <cmath>

int GetCell(int);

int main(int argc, const char* argv[])
{
	int* i = new int(0);
	int* a = new int(argc);
 
	for(;*i < *a;++*i)
	{
		std::cout << argv[*i];
	}
	std::cout << std::endl;
	
	delete i,a;

	std::vector<int> bf_jump_left;
	std::vector<int> bf_jump_right;
	int* iC = new int(0);
	std::string* buf = new std::string("");

	std::string szCode =">+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-]<.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.";

	
	int* length = new int(szCode.length());
	i = new int(0);

	for(;*i < *length;++*i)
	{
		if(szCode[*i] == '[') bf_jump_right.push_back (*i);
		if(szCode[*i] == ']') bf_jump_left.push_back (*i);
	}
	std::cout << std::endl;
	delete length,i;

	unsigned int index = 0;
	int index_r = -1;
	int index_l = -1;
	int cell = 0;
	std::string aCode = szCode;
	int* Memory = new int[30000]();
	while(index < aCode.length())
	{
			if(aCode[index]=='[')
			{
				index_r += 1;
				if(Memory[GetCell(cell)] == 0)
				{
					index = bf_jump_left[index_r];
					index_r -= 1;
					continue;
				}
			}
			if(aCode[index]==']')
			{
				index_l += 1;
				if(Memory[GetCell(cell)] != 0)
				{
					index = bf_jump_right[index_l];
					index_l -= 1;
					continue;
				}
			}
			if(aCode[index]=='<')
			{
				cell -= 1;
 
			}
			if(aCode[index]=='>')
			{
				cell += 1;
 
			}
			if(aCode[index]=='+')
			{
				Memory[GetCell(cell)] += 1;
				Memory[GetCell(cell)] %= 256;
 
			}
			if(aCode[index]=='-')
			{
				Memory[GetCell(cell)] -= 1;
				if(Memory[GetCell(cell)] < 0) 
					Memory[GetCell(cell)] += 256;
 
			}
			if(aCode[index]=='.')
			{
				(*buf)+=((char)Memory[GetCell(cell)]);
				//std::cout << (Memory[GetCell(cell)]) << ";";
 
			}
			index +=1;
		}

	std::cout << (*buf).c_str();
	_getche();
	return 0;
}

int GetCell(int iCell)
{
	return((abs(iCell)*2) - (iCell < 0));

}

[edit] WeirdScript

WeirdScript is a ring-based esoteric language. Variables are stored unamed, but they recieve an adress.

Before we take care at some details, let's have a look at a example programme How everyone would expect, it is the well known "Hello World" Programm.


/% Hello World Programm in WeirdScript %/
nr{0};
cl 0 [0] {
   rsrv -> +z; //z does not exist
   "Hello World!" -> +z;
   prnt -> +z;
   kll -> +z;
   //Just for fun we'll print 4.
   rsrv -> +z;
   (s) -> +z;
   prnt -> +z;
   kll -> +z;
}

z is 0 k is 1 s is 2 i is 3 k* is 10 s* is 20 i** is 30 (k) is 0 (s) is 2 (i) is 4 +k is 2 +z is 1

[edit] ASM-Fuck

ASM-Fuck has things from Assembler (not so many) and things from esolangs. The interpreter will be in python.

[edit] Types

[char]([value])[type]

  • # for integer
  • $ for strings

[edit] Instructions

  • '[char or other instructions] Tells the interpreter with what he schould do something.
  • > Adds one to a temporary var.
  • < Subs one from a temporary var.
  • + Adds to the choosen var the temporary var.
  • - The same with sub.
  • * The same with mul.
  • / The same with div.
  • ^ Push the var on to the stack.
  • v Pop from the stack.
  • out prints the var.

More features coming soon.

[edit] Example

//An addition in ASM-fuck
.section DATA:
                 f(0)#
                 e(0)#
                 r(0)#
end_section;
.section CODE:
                 'f>>>>+^; @init f init 4 and adds it to f and push f on stack
                 'e>>>>+^; @the same with e
                 '+vvr;    @init addition, pop a, pop b add a,b ->r
                 out r;    @print r
end_section;
//The MAKRO
.section DATA:
                 a(0)#
end_section;
.section MAKRO:
                 add(0,1):
                             '0^;    @push Parameter 0
                             '1^;    @push Parameter 1
                             '+vv0;  @init add, pop a, pop b, add a,b store in 0
                             '0^;    @push 0
                 end_;               @end of the function
end_section;
.section CODE:
                call add(4,4);       @call the add function with the parameters 4 and 4
                'av;                 @Now pop and store into a
                out a;               @out a. (Will print 8)
end_section;

[edit] PyBF

A simple non-wrapping BF Interpreter in Python written by me.

import re
import string
import random







def bf_start():
 input_var = raw_input()
 bf_interpret(input_var)
 
def GetCell(cell):
	return ((abs(cell)*2) - (cell < 0))

def bf_interpret(codestring):
 bf_jump_right = []
 bf_jumps_right = []
 bf_jump_left = []
 counter = 0
 code = []
 for chr_ in codestring:
	 code.append(chr_)
	 if (chr_ == '['):
		 bf_jump_right.append(counter)
		 bf_jumps_right.append(counter)
	 if (chr_ == ']'):
		 bf_jump_left.append(bf_jumps_right.pop())
         counter = counter + 1
 #print bf_jump_right
 #print bf_jump_left
 index = 0
 index_r = -1
 index_l = -1
 Memory = []
 i = 0
 while (i < 1000001):
	 Memory.append(0)
	 i = i +1
 cell = 0
 while (index < len(code)):
	 if code[index] == '[':
		 index_r = index_r + 1
		 if Memory[GetCell(cell)] == 0:
			 index = bf_jump_left[index_r]
			 index_r = index_r - 1
			 #print 'Goto ',index
			 continue
		 
	 if code[index] == ']':
		 index_l = index_l + 1
		 if Memory[GetCell(cell)] != 0:
			 index = bf_jump_right[index_l]
			 index_l = index_l - 1
			 #print 'Goto ',index
			 continue
	 if code[index] == '>':
		 cell = cell + 1
	 if code[index] == '<':
		 cell = cell - 1
	 if code[index] == '+':
		 Memory[GetCell(cell)] = Memory[GetCell(cell)] + 1
	 if code[index] == '-':
		 Memory[GetCell(cell)] = Memory[GetCell(cell)] - 1
	 if code[index] == '.':
		 print str(chr(int(Memory[GetCell(cell)])))
	 if code[index] == ',':
		 Memory[GetCell(cell)] = raw_input()
	 if code[index] == ':':
		 print Memory[GetCell(cell)]
         index = index + 1
bf_start()

[edit] zZOMG!

Finished. Documentation and Interpreter comming soon.

[edit] Foga 2k

< Move the pointer left
> Move the pointer right
+ Increments the cell under the pointer
- Decrements the cell under the pointer
^ The Cell has the new value (Cell * Cell)
% The Cell has the new value (Cell ^ 1/2) (Sqrt)
# Prints the curent cell out as string
@ Prints the curent cell out as ascii.
? The cell has the new value pi (3.14159 and so on)
! The cell has the new value 0.
{ Label (Jumpmark)
} If the cell != 1, then jump back to { else continue.
( Label (Jumpmark)
) If the cell != 0, then jump back to ( else continue.
| Label for ifs.
X and Y are Variable form 0 to 9. That means, there are 10 Variables.
$(x,y) if x = y continue, else back to the |
ç(x,y) if not x = y continue, else back to |
&(x,y) if x > y continue, else back to |
=(x,y) if x < y continue, else back to |
*(x,y) x is now x * y
/(x,y) x is now x/y
;(x) creates the var x, x has the value = Cell (x can only be 0,1,2,3,4,5,6,7,8 or 9)
:(x) prints out the var x as string
_(x) prints out the var x as ascii.
\ Back to the begin of the programm.
s Input as string
i Input as number.
[...] .. statesment between [] will eceuted twice. You can just use statesment of one character. like +-^%. [++++^] is equals to ++++++++^^
x(x) The cell gains the value from the var x.
8(x) var x = x + Cell
¬ Cell to ascii
f fibonacci
q faculty
o Label (Jumpmark)
a back to o
G Jumps to the line (value = Cell) ++G will jump to the second line.
A(x,y) if x=y G
B(x,y) if not x=y G
C(x,y) if x>y G
D(x,y) if not x>y G
E(x,y) x = x mod y
r random number. (between 0 and cell)
p Interupt
1 sin
2 cos
3 tan
4 asin
5 acos
6 atan
g ignore the next 10 characters
y The y will jump to the next character, interpret him only, if it is a jumpmark. Then jump to next character and ignore it. Then continue. y+++, will only makes a +. y{++}# . This will add 1. Then go back to { and add 2, an prints ouut 3. You can not use operations with more then one character like E(x,y) (thats a 6 Character op)( x(x) is a 4 character op) use d for 4 character ops. And e for 6 character ops.
F(x) Creates a special var. its like an array f[var x,value of cell] x ist the value from the var x. +++++;(1)F(1) This will make f[5,5]. SO the 5 index of f is 5. +++++;(1)----F(1) is f[5,1] the 5 index of f is 1.
H(x) Reads the array. +;(1)!+++++F(1)!H(1)# Creates f[1,5] and reads f[1] to the cell. This example will print 5. I know, its difficult to understand.

Examples:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++@
Prints out A
[++++++++++][++++++++++][++++++++++]+++++@
Prints out A
[++++]^+@
Prints out A
?;(1)>+++;(2)*(1,2):(1)
-- Guess ;)
[+++++]f@
Prints out Y
[++]+q@
Prints out x
>[+++++]r;(1)<|i;(2)$(1,2)
A small game. You need to input a number form 1-10. The programm end if you inputed the right number.
>[+++++];(9)[+++++++++];(8)<o+;(1)f;(2):(2)_(9)x(1)y|a&(1,8)
Prints out some fibonacci numbers.
[++++]^[++++]@![+++++]^+@[+++]+@@+++@![+++]^[++++]@![+++]^[--]@![+++++]+^--@[----]@+++@[--]--@+[----]-@

Thats a Hello, world programm.

>+++++++++(<++++++++>-)<@>+++++++(<++++>-)<+@+++++++@@+++@>>>++++++++(<++++>-)<@>>>++++++++++(<+++++++++>-)<---@<<<<@+++@------@--------@>>+@


The Hello World!-Programm from BF translated to Foga 2k.

++G 
+G
+G
+G
+G
+G
+G
+G
+G
#

This prints 10.

Interpreter: Download here http://clonkturm.cl.ohost.de/Foga_2k.exe (only for win and needs .NET Framework 2.0) (Bugfixed)

[edit] Quit Reloaded

Quit Reloaded is based on IRC-Commands.

/JOIN -- Add x to the var
/PART -- Sub x to the var
/CS -- Output as ASCII
/NS -- Output as String
/QUIT -- Root
/NICK -- ^2
/SERVER -- var = 0
/QUERY -- NewLine


/MSG -- Input
/KICK -- Division. /JOIN 100 /KICK 50 equals 2.
/INVITE -- Multiplication. /JOIN 2 /INVITE 50 equals 100.

Misc:

/JOIN #eso -- this will add 3. Because the length of the string after # is 3. /PART #eso -- same... 6/JOIN 5 -- this will add 65

The characters after /NS,/CS (Not /JOIN and /PART) and others will be ignored. /CS #esoteric op Foo is the same like /CS


Hello World Programm:

/JOIN 104 
/CS help 
/PART 104 
/JOIN 110 
/PART 9 
/CS register #clonken foo foo@foo.ch 
/JOIN 7 
/CS aop #clonken add Feuermonster 
/CS muh? 
/JOIN 3 
/CS 
/PART 111 
/JOIN 44 
/CS 
/PART 44 
/JOIN 32 
/CS 
/PART 32 
/JOIN 119 
/CS hallo? 
/PART 8 
/CS 
/JOIN 3 
/CS 
/PART 6 
/CS 
/PART 8
/CS 

Interpreter (only for win and needs .Net-Framerwork 2.0) http://clonkturm.cl.ohost.de/Quit_Reloaded.exe

[edit] Projects

Now, I m working to finish the documentations and creating a new esoteric language called ASM-Fuck.

Personal tools