DFS

From Esolang
Jump to navigation Jump to search

DFS here doesn't stand for "Depth First Search", it stands for "Deadfish", the author named it DFS because the name DF is already taken by DateFuck.

DFS is Deadfish extended by User:None1, char I/O is added.

Commands

Here are the commands in DFS.

i    increment
d    decrement
s    square
o    output
O    char output
l    input
L    char input

Note that the accumulator in DFS is a byte, which wraps when overflows.

Example Programs

Hello World

iiisdsiiiiiiiiOiiiiiiiiiiiiiiiiiiiiiiiiiiiiiOiiiiiiiOOiiiO
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddOddddddddddddO
dddddddddddddddddddddsddOddddddddOiiiOddddddOddddddddO
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddO

Interpreter

C

#include<stdio.h>
int main(){
    char x=0,c;
    while((c=getchar())!=EOF){
        if(c=='i') x++;
        if(c=='d') x--;
        if(c=='o') printf("%d",(int)x);
        if(c=='s') x=x*x;
        if(c=='O') putchar(x);
        if(c=='l') scanf("%d",&x);
        if(c=='L') x=getchar();
    }
    return 0;
}