Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

DESU~ DESU DESU, DESU

Name: Anonymous 2012-04-21 3:47


d - increment address pointer
e - increment value of byte
s - print to ascii from current address cell
u - input ascii from current address cell
~ - jump to matching "," on current cell value being zero,
      continue to next instruction otherwise.
, - jump back to matching "~", reevaluate "~"
(space) - reset address pointer to zero

Name: Anonymous 2012-04-21 4:41

Looks like brainfuck.

Name: pedobear 2012-04-21 5:39

░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░
░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░
░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░
░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░
░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░
█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█
█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█
░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░
░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░
░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░
░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░
░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░
░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░
░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░
░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░ goota agrre

Name: spurdo 2012-04-21 5:42

>>3
offiser :---DDDD
is there an problem?? :------DDDDDDDDDD

Name: Anonymous 2012-04-21 5:47

>>4
go bag do the imageböarnds :---DDDDDDDDDD

Name: Anonymous 2012-04-21 6:44


anon@HAXUS$ cat DESU.c
#include <stdio.h>
char m[1000];
char* p=m;
#define D p++;
#define E ++*p;
#define S putchar(*p);
#define U *p=getchar();
#define tilde while(*p){
#define comma }
#define space p=m;
int main(){
    D
    E
    S
    U
    tilde
    space
    D
    E
    S
    U
    space
    D
    E
    S
    U
    comma
    space
    D
    E
    S
    U
    return(0);
}
anon@HAXUS$ cc DESU.c -o desu
anon@HAXUS$ ./desu
abcdefghijklmnopqrstuvwxyz0123456789  
bcdefghijklmnopqrstuvwxyz{123456789:

Name: Anonymous 2012-04-21 7:57

sweet,, brb gonna implement an interpreter.......

Name: Anonymous 2012-04-21 8:45

SHIT OLD MAN SHIT BERT OLD MAN BAG TODDLENAUT SHOULDER CARBON PUSSY WORM CHEEK FART BACK BANG ANGER SACK FACE CARTILAGE NOSE DAY DAY NOSE SPERM SWALLOW FISH CUNT FACE PIG BOVINE ANIMAL

Name: 7 2012-04-21 18:01

I need to implement the ~ , using jumps instead of walking at run time, but here is something that I think works. # are line comments so you can write shell scripts with it.


#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>


#define MAX_PROGRAM_SIZE 32768
#define DATA_BUFFER_SIZE MAX_PROGRAM_SIZE

#define PROGRAM_CHARACTER_CASE \
  'd':case'e':case's':case'u':case'~':case',':case' ': \
  case'D':case'E':case'S':case'U'


#ifdef NO_CHECKS
#define CHECK(condition, message)
#else
#define CHECK(condition, message) if(condition) { message; }
#endif

//#define DO_TRACE

#ifdef DO_TRACE
#define TRACE(...) fprintf(stderr, "Trace: %s: %d: ", __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__);
#else
#define TRACE(...)
#endif

char program[MAX_PROGRAM_SIZE];
char data[DATA_BUFFER_SIZE];

struct position
  {
    size_t line;
    size_t column;
  };
struct position positions[MAX_PROGRAM_SIZE];

int jump_table[MAX_PROGRAM_SIZE];

char* p;
char* s;

size_t read_program(FILE* input)
  {
    size_t size = fread(program, sizeof(char), MAX_PROGRAM_SIZE, input);
    return size;
  }

enum state
  {
    normal,
    line_comment
  };

size_t compress_program(size_t program_size)
  {
    size_t write_index = 0;
    size_t index;
    size_t l = 1;
    size_t c = 1;
    enum state state = normal;
    for(index = 0; index < program_size; ++index, ++c)
      {
        switch(state)
          {
            case normal:
              switch(program[index])
                {
                  case '\n': l++; c = 0; break;
                  case '#': state = line_comment; break; // # used for line comments to enable #!/usr/bin/desu~ script invocations.
                  case PROGRAM_CHARACTER_CASE:
                    program[write_index] = tolower(program[index]);
                                        positions[write_index].line = l;
                                        positions[write_index].column = c;
                                        ++write_index;
                                        break;
                                    default: fprintf(stderr, "%s: %s: warning: line %u: column %u: invalid character ignored: '%c'.\n", p, s, l, c, program[index]);
                }
              break;
            case line_comment:
              switch(program[index])
                {
                  case '\n': l++; c = 0; state = normal; break;
                  default: break;
                }
          }
      }
    return write_index;
  }

void init_data_buffer()
  {
    memset(data, 0, sizeof(data));
  }

void execute_program(size_t program_size)
  {
    size_t pc = 0;
    size_t data_address = 0;
        size_t balance_count;
    while(pc != program_size)
      {
                TRACE("at %c, line %u, column %u.\n", program[pc], positions[pc].line, positions[pc].column);
        switch(program[pc])
          {
            case 'd':
              CHECK(data_address == DATA_BUFFER_SIZE - 1,
                fprintf(stderr, "%s: %s: run time error: line %d: column %d: tried to increment the address pointer past DATA_BUFFER_SIZE: %d\n",
                        p, s, positions[pc].line, positions[pc].column, DATA_BUFFER_SIZE);
                return;
                );
              data_address++;
              pc++;
              break;
            case 'e':
              data[data_address]++;
              pc++;
              break;
            case 's':
              putchar(data[data_address]);
              pc++;
              break;
            case 'u':
              data[data_address] = getchar(); // how to detect eof?
              pc++;
              break;
            case '~': // optimize this by using parsing and compiling jump offsets.
                            if(!data[data_address])
                              {
                  balance_count = 1;
                                pc++;
                  while(pc < program_size && balance_count)
                                  {
                                        switch(program[pc])
                                        {
                                            case '~': ++balance_count; break;
                                            case ',': --balance_count; break;
                                            default: break;
                                        }
                                        pc++;
                                    }
                                }
                            else
                              {
                                    pc++;
                                }
              break;
            case ',': // This seeking back and forth is terrible.
                            CHECK(!pc, fprintf(stderr, "%s: %s: error first character is ','\n", p, s); return; );
              balance_count = 1;
                            pc--;
              while(pc && balance_count)
                              {
                                    switch(program[pc])
                                    {
                                        case '~': --balance_count; break;
                                        case ',': ++balance_count; --pc; break;
                                        default: --pc; break;
                                    }
                                }
              break;
            case ' ':
                            data_address = 0;
                            ++pc;
                            break;
            default: assert(0);
          }
      }
  }

int main(int argc, char** argv)
  {
    p = argv[0];
    if(argc != 2) { fprintf(stderr, "%s: usage: %s source-file-name\n", p, p); return 1; }
        s = argv[1];
    FILE* source = fopen(s, "r");
    if(!source) { fprintf(stderr, "%s: could not open source file: %s: %s\n", p, s, strerror(errno)); return 2; }
    size_t chars = read_program(source);
    fclose(source);
    size_t code_chars = compress_program(chars);
    init_data_buffer();
    execute_program(code_chars);
    return 0;
  }

Name: Anonymous 2012-04-22 7:26


EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
EEEEEEEEEEEEEEEEEEEEEEEEEEEEES
EEEEEEESS
EEES
~E,
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
EEEEEEEEEEEEEEEEEEEEEEEES
EEES
~E,
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
~E,
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
~E,
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES
ES
EEEEEEEEEEEEEES
EES
~E,
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESS

Name: Anonymous 2012-04-22 7:36

Perfect time to show off a Ruby Brainfuck interpreter I wrote a while ago using Treetop.

require 'polyglot'
require 'treetop'
include Treetop::Runtime

$tape = Hash.new 0; $ptr = 0

module Brainfuck
  class Program < SyntaxNode;        def run; elements.each { |i| i.run };             end; end
  class MoveRight < SyntaxNode;      def run; $ptr += 1;                               end; end
  class Increment < SyntaxNode;      def run; $tape[$ptr] = ($tape[$ptr] + 1) % 256;   end; end
  class WriteCharacter < SyntaxNode; def run; putc $tape[$ptr];                        end; end
  class ReadCharacter < SyntaxNode;  def run; $tape[$ptr] = (STDIN.getc.ord rescue 0); end; end
  class Loop < SyntaxNode;           def run; elements[1].run while $tape[$ptr] != 0;  end; end
  class ZeroPointer < SyntaxNode;    def run; $ptr = 0;                                end; end
end

Treetop.load_from_string(DATA.read)
BrainfuckParser.new.parse('desu~ desu desu, desu').run

__END__
grammar Brainfuck
  rule program
    command* <Program>
  end
  rule command
    'd' <MoveRight> /
    'e' <Increment> /
    's' <WriteCharacter> /
    'u' <ReadCharacter> /
    '~' program ',' <Loop> /
    ' ' <ZeroPointer>
  end
end

Name: bampu pantsu 2012-05-29 4:33

bampu pantsu

Name: Anonymous 2012-12-26 3:17

sagedesu

Name: Anonymous 2013-01-08 10:15

Time changes after your 14th birthday!

Don't change these.
Name: Email:
Entire Thread Thread List