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-01 13:21

A FULL implementation of The ABC Programming Language in the Algorithmic Language:
(define (abc source)
  (define accumulator 0)
  (define ascii #f)
  (define (interpret i)
    (cond ((char-ci=? i #\a) (set! accumulator (+ 1 accumulator)))
          ((char-ci=? i #\b) (set! accumulator (- 1 accumulator)))
          ((char-ci=? i #\c) (display (if (eq? #t ascii)
                                          (integer->char accumulator)
                                          accumulator)))
          ((char-ci=? i #\d) (set! accumulator (* (- 1) accumulator)))
          ((char-ci=? i #\r) (set! accumulator (random accumulator)))
          ((char-ci=? i #\n) (set! accumulator 0))
          ((char-ci=? i #\$) (set! ascii (not ascii)))
          ((char-ci=? i #\l) (run))
          ((char-ci=? i #\;) (display accumulator)
                             (display (integer->char accumulator)))))
  (define (run)
    (for-each interpret (string->list source))
    (newline))
  (run))

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