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

Pages: 1-4041-

Brainfuck

Name: Anonymous 2009-12-19 3:12

So I couldn't sleep and out of boredom wrote a brainfuck to C compiler.

http://nopaste.info/73ec0c6fa7_nl.html

Name: HAHAHaruhi !6mHaRuhies 2009-12-19 3:53

ANONIX PUBLIC LICENSE
www

Name: Anonymous 2009-12-19 4:40

ANONUX

Name: Anonymous 2009-12-19 4:54

ANON MY ANIX

Name: Anonymous 2009-12-19 5:57

If you're anonymous, then why bother with licenses? It's not like anybody can claim the copyright to anonymous software.

Name: Anonymous 2009-12-19 6:14

>>5
sudo: this wasn't serious, [b][o][u][i]faggot[/i][/u][/o][/b]

Name: Anonymous 2009-12-19 6:36

DOLPHIN LINUX

Name: Anonymous 2009-12-19 7:21

>>6
cant use BBcode tags inquite ironic

Name: Anonymous 2009-12-19 7:23

>>8
goddamnit how did this happen !
should have used [#] instead of [rem]

Name: Anonymous 2009-12-19 9:29

oh, the BBCODE failure is causing me PHYSICAL PAIN

Name: Anonymous 2009-12-20 0:30

good work. very well done.

Name: Anonymous 2009-12-20 1:20

Next time write it in a real language, like newLISP1.

_________
1. https://gist.github.com/242690/200f563a675b016e4ba56b59335736559eb6feca

Name: Anonymous 2009-12-20 15:06

worst peice of shit I've ever seen OP

Name: Anonymous 2009-12-20 16:05

ANONIX

Name: Anonymous 2009-12-20 19:08

-> #include <getopt.h>
fclose(input) -> fclose(input);
return 0; -> return EXIT_SUCCESS;
return -1; -> return EXIT_FAILURE;

Name: Anonymous 2009-12-20 21:47

This thread has been closed and replaced with the following thread:

Subject: Compiling Brainfuck code with a C compiler
Name:
Email:

It works.

Name: Anonymous 2009-12-21 14:36

>>15
For me, getopt() is in unistd.h

Name: Anonymous 2009-12-21 18:49

>>17

learn2c99

Name: Anonymous 2009-12-21 22:47

Speaking of getopt, what do commercial products use these days for parsing command-line options? getopt is GPL; is there a similar library with a zlib-style license?

Name: RMS Mark Shuttleworth 2009-12-21 22:53

>>19
s/commercial/non-free(as in freedom)/

Name: Anonymous 2009-12-22 0:35

>>19
getopt isn't ``GPL''. As a concept it's part of POSIX, and there are many different implementations under many licenses.
The GNU version does have some GNU-specific extensions (getopt_long and getopt_long_only), and obviously that library is licensed under the GPL. Is that what you were thinking of?

As far as I know, commercial products don't parse command line options at all, and just stick a giant configuration GUI in front of it, or get options from XML.

Name: Anonymous 2009-12-22 0:43

>>21
Ah I see. I didn't realize it was in POSIX. Googling "free getopt" brought me to, fittingly enough, freegetopt.sourceforge.net .

Name: Anonymous 2009-12-22 1:32

>>18
C99 MY ANUS

Name: Anonymous 2009-12-22 2:06

>>19
getopt() is less than 20 lines of C for the full POSIX implementation, and probably takes a few minutes to write.

Name: Anonymous 2009-12-22 5:37

>>24

C:\temp\>wc -l getopt.c
1278 getopt.c

Name: Anonymous 2009-12-22 5:48

>>25
GNU Bloat

Name: Anonymous 2009-12-22 5:52

>>25
GNU also supports long options, which makes parsing a bit less straightforward, and has a few extra functions in there.
Also, like two thirds of that is comments.

Name: Anonymous 2009-12-22 8:09

>>27
So you're off not by a factor of 60 at least, but only by factor of 30 or so? Read the source, there are not so many comments really.

Whatever, I dare you to write your own POSIX-compliant getopt implementation. That would be a "few" minutes well-spent, homosexual!

Name: Anonymous 2009-12-22 9:17

Implement your own standard library.

Name: Anonymous 2009-12-22 9:48

>>24
Implement it and post source for proof.

Name: Anonymous 2009-12-22 11:53

>>28
So you
I don't know who you think you're talking to. POSIX getopt is really straightforward, though. Even /prog/ should be able to write an implementation.

Name: Anonymous 2009-12-22 18:05

>>29
IMPLEMENT MY ANUS

Name: Anonymous 2009-12-23 1:00

>>30

/* @getopt.c */
#include <string.h>
#include <stdio.h>

char *optarg;
int optind=1, opterr, optopt;
static int optoptind=1;



int getopt(int argc, char *const argv[], const char *optstring) {
 char *s, c;
 if(!argv[optind] || *argv[optind]!='-' || !strcmp(argv[optind],"-") || !strcmp(argv[optind++],"--"))
  return -1;
 if(s=strchr(optstring,c=argv[--optind][optoptind++])) {
  if(s[1]==':') {
   optarg = argv[optind++][optoptind]? optoptind=0,&argv[optind][optoptind]:argv[optind++];
   if(optind>argc)
    c= do_opt_err(argv,':',c);
  }
 } else
  c = do_opt_err(argv,'?',c);
 optoptind = argv[optind][optoptind]?optoptind:optind++,1;
 return c;
}



static int do_opt_err(char **argv, char c, char d) {
 fprintf(stderr,"%s: %s %c",c=='?'?"invalid option":"missing argument for option",d);
 return optopt=d;
}

Name: Anonymous 2009-12-23 5:14

>>33

your code's ugliness haunts my very existence

Name: Anonymous 2009-12-23 6:20

>>34
You have much to learn young padawan

Name: Anonymous 2009-12-23 6:49

>>34
There's really no pretty way to write getopt. Options can be passed in disgusting ways.

Name: Anonymous 2009-12-23 8:14

>>33
I'm impressed beyond anything words can convey.
Your tricks are evil and ingenious.
You forgot to check opterr though ;P

Name: Anonymous 2009-12-23 8:57

brb

Name: Anonymous 2009-12-23 9:01

>>38
gt on irc fgt

Name: Anonymous 2009-12-23 10:03

>>39
GET ON MY ANUS

Name: Anonymous 2009-12-23 10:08

pseudo-code for a future prog bot


while true
do
  each threads t
  do
    each t.posts p
    do
      v = extract_verb(p)
      if(v)
        do_post("[b][i]%s MY ANUS[/i][/b]",v)
    done
  done
done

Name: Anonymous 2009-12-23 10:30

BUTTSORT MY ANUS

Name: Anonymous 2009-12-23 10:47

>>41
EXTRACT MY ANUS

Name: Anonymous 2009-12-24 4:07

>>41
Could you reformulate that in brainfuck?

Name: Anonymous 2009-12-24 10:00

>>41
You can't write pseudocode in Ruby. Get out of Prague.

Name: Anonymous 2009-12-24 13:15

>>45
Please stop pimping your shitty /prog/ nickname.

Name: Anonymous 2009-12-24 13:30

>>46
Lets call it eu/proge/

Name: Anonymous 2009-12-24 14:12

Here's my C to Brainfuck compiler, written in perl:

foreach(<>){
  s/++ptr;/>/;
  s/--ptr;/</;
  s/++\*ptr;/+/;
  s/--\*ptr;/-/;
  s/putchar\(\*ptr\);/./;
  s/putchar\(\*ptr\);/,/;
  s/while \(\*ptr\) {/[/;
  s/}/]/;
  print;
}


It doesn't quite support the whole C standard, though.

Name: Anonymous 2009-12-24 14:33

>>48
SUPPORT MY ANUS

Name: Anonymous 2009-12-24 14:35

Quantifier follows nothing in regex; marked by <-- HERE in m/+ <-- HERE +ptr;/ at >>48 line 4.

Name: Anonymous 2009-12-24 20:41

>>50
don't tell me you actually run his code - this is perl, it could do anything, really

Name: Anonymous 2009-12-24 22:17

All I can say to this is lol. This is basically the exact experience that I have had with the post-secondary institutions within the United States. I can honestly say that for the majority that professors and the institution wish to stifle creativity and independent thought. The narrow minded answers they want completely disregard the plethora of other choices that would reveal the correct answer. Whether or not the story is true, this is the attitude of the American educational institute, for those that think outside the box continue to. Revolutionist, non-conventionalist, and the blatant disregard for normalcy are the fundamentals to continuing our species in the area of science.

Name: Anonymous 2009-12-25 7:26

>>51
is right. I ran the code and it cut my fucking dick off!

Name: sage and hide 2009-12-25 8:11

>>52
Cool pasta, bro!

Name: Anonymous 2009-12-25 9:04

DRIVE LIKE JEHU

Name: Anonymous 2011-02-03 0:04

Name: Anonymous 2011-02-03 8:24

Name: Anonymous 2011-02-04 17:38


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