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

ITT the ABC Programming Language

Name: Anonymous 2008-07-29 19:29

#include <stdio.h>

int main(int argc,char argv*[]){
  int i = 0;
  int BUFFA;

  while(argv[i]!='\0'){
    if(argv[i]='a')
      BUFFA++;
    else if(argv[i]='b')
      BUFFA--;
    else if(argv[i]='c')
      printf("%i\n",BUFFA);
    else printf("%s","Error.\n");
  }
}

Name: Anonymous 2008-08-04 11:54

if you missed the PHP reference implementation here it is:
<?php
if (substr(php_sapi_name(), 0, 3) != 'cli') show_source(__FILE__) xor die();
$prog=file_get_contents("php://stdin");
$ascii=false;
$acc=0;
for($i=0;$i<strlen($prog);$i++) {
  $c=$prog[$i];
  switch($c) {
    case 'a': $acc++; break;
    case 'b': $acc--; break;
    case 'c': if($ascii) echo chr($acc); else echo $acc; break;
    case 'd': $acc*=-1; break;
    case 'r': $acc=mt_rand(0,$acc); break;
    case 'n': $acc=0; break;
    case '$': $ascii=!$ascii; break;
    case 'l': $i=-1; break;
    case ';': echo $acc.chr($acc); break;
  }
}

Name: Anonymous 2008-08-04 12:54

rather then adding another letter to the ABC Programming Language to handle control structures how about taking an ascii control character that never gets used and make it an escape character for the sequence that defines the branch

Name: Anonymous 2008-08-04 12:57

then

Name: Anonymous 2008-08-04 12:58

<gibberish>

Name: Anonymous 2008-08-04 21:24

>>122
Holy fuck you're evil

Name: Anonymous 2008-08-04 22:08

This is the only thread active on /prog/ with source code in the first post :(

Name: Anonymous 2008-08-04 22:26

>>126
That's depressing (although not new)

Name: Anonymous 2008-08-04 22:27

128GET

Name: Anonymous 2008-08-05 9:20

>>126
There's more programming discussion on /prog/ right now than there has been in many months.

Name: Anonymous 2008-08-05 11:38

Even if it IS an esoteric one.

Name: Anonymous 2008-08-05 13:42

Name: Anonymous 2008-08-05 13:59

I write that PHP implementation, even though I didn't make that program language ABC. Does it still a reference implementation? I guess it is if User:Orange decides it to be.

Name: Anonymous 2008-08-05 18:59

looks pretty much like a knockoff version of Brainfuck to me...

Name: Anonymous 2008-08-06 1:05

I'm surprised no one even touched the wiki page.

Name: Anonymous 2008-08-06 6:49

You didn't look very closely (or too soon, whatever)

Name: Anonymous 2008-08-06 6:50

Apparently Orange himself visits /prog/ and linked to this thread

Name: Anonymous 2008-08-06 8:35

>>136
Then there's only two possibilities: either you're User:Orange, or the Sussman invented the ABC programming language.

Name: Anonymous 2008-08-06 8:54

>>137
I assure you, GJS never touched this faggotry.

Name: Anonymous 2008-08-06 9:12

>>137
Your logic is infallible!

Name: Anonymous 2008-08-06 10:38

    #!/usr/bin/perl
    $_=<>;$i=0;s/a/$i++;/g;s/b/$i--;/g;s/c/print$i,"\n";/g;eval$_

Name: Anonymous 2008-08-06 10:39

fucking bbcode


#!/usr/bin/perl
$_=<>;$i=0;s/a/$i++;/g;s/b/$i--;/g;s/c/print$i,"\n";/g;eval$_

Name: Anonymous 2008-08-06 12:33

This thread still lacks compiler.

#!/usr/bin/perl

$pre = <<EOF;
#include <stdio.h>

int main()
{
    int acc = 0, asc = 0;
EOF

$pre_rand = <<EOF;
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int acc = 0, asc = 0;
    srandomdev();
EOF

$post = <<EOF;
    putchar('\\n');
}
EOF

$post_loop = <<EOF;
    }
}
EOF

%ops = (
    a => 'acc++',
    b => 'acc--',
    c => 'asc ? putchar(acc) : printf("%d", acc)',
    d => 'acc = -acc',
    r => 'acc = random() % (acc+1)',
    n => 'acc = 0',
    '$'=>'asc = !asc',
    ';'=>'printf("%d%c", acc, (char)acc)'
);

sub compile {
    my ($abc) = @_;
   
    die "Syntax error: unrecognized operator $1 at char $+[1]\n"
        if $abc =~ /([^abcdrn\$l;\s])/;
    warn "Unreachable code detected at char @{[$-[1]+(1)]}: $1\n"
        if $abc =~ /l\s*(\S+.*)/s;
   
    $abc =~ s/\s+//g;
    $has_rand = $abc =~ /r/;
    $has_loop = $abc =~ s/l.*//;
    $indent = "\t" . "\t" x $has_loop;
   
    (my $c = $abc) =~ s/(.)/$indent.$ops{$1}.";\n"/ge;
    $c = ($has_rand ? $pre_rand : $pre) .
         ($has_loop ? "\tfor(;;)\n\t{\n" : "") .
         $c .
         ($has_loop ? $post_loop : $post);
}

undef $/;
print compile <>;

Name: Anonymous 2008-08-06 12:54

This thread is made of win.

Name: Anonymous 2008-08-06 18:44

/prog/ ABC Interpreter and Compiler Suite
I came.

Name: Anonymous 2008-08-06 18:59

>>144

I lol'd irl

Name: Anonymous 2008-08-07 11:06

>>106

Gregor Richards has written one (http://esolangs.org/wiki/C2BF) and libbf has one (http://savannah.nongnu.org/projects/libbf).

Name: Anonymous 2008-08-11 12:12

i <3 sicp girl

Name: Anonymous 2008-08-13 13:29

Where is the ABCIDE?

Name: Anonymous 2008-08-13 13:53

>>148
All of the core developers are using vim, and I imagine most of our userbase is too.

Name: Anonymous 2008-08-26 2:08

150

Name: Anonymous 2008-08-26 3:02

You could do it like php with <?abc ?> tags - ABC outside of the tags would be printed to stdout and ABC inside of the tags would be instructions for an interpreter/opcodes for a vm.

Name: Anonymous 2008-08-26 6:37

>>151
Let's not emulate the worst language in mainstream use today, for a change.

Name: Anonymous 2008-08-26 11:35

>>152
Second worst, after this takes off.

Name: Anonymous 2008-08-26 15:00

>>152
The worst language in mainstream use? Ordered from ">>154 ain't doing that shit" to ">>154 will do that":

1. COBOL
2. Sepples
3. Visual Basic
4. Java
5. C
6. C#
7. PHP

And of course, >>154 will most happily do FIOC.

Name: Anonymous 2008-08-26 15:03

>>154
fixed

1. COBOL
2. PHP
3. Sepples
4. Visual Basic
5. C
6. Java
7. C#
8. BBCode

Name: Anonymous 2008-09-21 8:53

Name: Anonymous 2008-09-21 9:21

>>154
lol@PHP on top. Faggot.

>>155
lol@C# and Java over C. Faggot.

Name: Anonymous 2008-09-21 9:55

>>155,157
I'd much rather do PHP than Sepples, Visual Basic, Java, and probably C and C#. PHP's standard library sucks, but the language itself is dynamically-typed, simple, and cleaner than Perl and Ruby (though dirtier than most others), and it's getting first-class functions and anonymous closures in 5.3.

Name: Anonymous 2008-09-21 10:52

>>158
Will it have lexical scoping in 5.3 as well?

Name: Anonymous 2008-09-21 12:22

>>153
You have given me a new purpose in life. I will create a programming language that is worse than PHP.

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