cvsuser     02/12/08 20:00:37

  Modified:    config/gen makefiles.pl
               .        MANIFEST
  Added:       config/gen/makefiles bf.in
               languages/bf bf.pasm
  Removed:     config/gen/makefiles brainfuck.in
               languages/bf brainfuck.pasm
  Log:
  As long as we're removing the fucking thing, so to speak, we may as
  well complete the job.
  
  Revision  Changes    Path
  1.1                  parrot/config/gen/makefiles/bf.in
  
  Index: bf.in
  ===================================================================
  RM_F = ${rm_f}
  PERL = ${perl}
  
  ASSEMBLE=$(PERL) ../../assemble.pl
  PARROT=../../parrot
  
  all: build
  
  test: build
        $(PARROT) bf.pbc test.bf
  
  build: bf.pasm
        $(ASSEMBLE) bf.pasm > bf.pbc
  
  clean:
        $(RM_F) core *.pbc *~
  
  
  
  1.1                  parrot/languages/bf/bf.pasm
  
  Index: bf.pasm
  ===================================================================
  # $Id: bf.pasm,v 1.1 2002/12/09 04:00:27 sfink Exp $
  # A Brainfuck interpreter
  # By Leon Brocard <[EMAIL PROTECTED]>
  # 
  # See http://www.catseye.mb.ca/esoteric/bf/
  # for more information on this silly language
  
    # Get the brainfuck source file into S0
    set S0, P0[1]
    if S0, SOURCE
    set S0, P0[0]
    print "usage: ./parrot "
    print S0
    print " file.bf\n"
    end
  
    # Read the file into S1
  SOURCE:
    open I0, S0
  SOURCE_LOOP:
    readline S2, I0
    concat S1, S2
    if S2, SOURCE_LOOP
    close I0
  
    length I30, S1
  
    # Initialise
  
    set I0, 0          # Our PC
    new P0, .PerlArray # Our memory
    set I1, 0          # Our pointer
  
    # The main interpreter loop
  INTERP:
    substr S0, S1, I0, 1
    ne S0, "+", NOTPLUS
    set I2, P0[I1]
    inc I2
    set P0[I1], I2
    branch NEXT
  
  NOTPLUS:
    ne S0, "-", NOTMINUS
    set I2, P0[I1]
    dec I2
    set P0[I1], I2
    branch NEXT
  
  NOTMINUS:
    ne S0, ">", NOTGT
    inc I1
    branch NEXT
  
  NOTGT:
    ne S0, "<", NOTLT
    dec I1
    branch NEXT
  
  NOTLT:
    ne S0, "[", NOTOPEN
  
    set I2, P0[I1]
    if I2, NEXT
    set I2, 0 # "depth"
  
  OPEN_LOOP:
    inc I0
    substr S2, S1, I0, 1
    ne S2, "[", OPEN_NOTOPEN
    inc I2
    branch OPEN_LOOP
  OPEN_NOTOPEN:
    ne S2, "]", OPEN_LOOP
    eq I2, 0, NEXT
    dec I2
    branch OPEN_LOOP
  
  NOTOPEN:
    ne S0, "]", NOTCLOSE
    set I2, 0 # "height"
  
  CLOSE_LOOP:
    dec I0
    substr S2, S1, I0, 1
    ne S2, "]", CLOSE_NOTCLOSE
    inc I2
    branch CLOSE_LOOP
  CLOSE_NOTCLOSE:
    ne S2, "[", CLOSE_LOOP
    eq I2, 0, INTERP
    dec I2
    branch CLOSE_LOOP
  
  NOTCLOSE:
    ne S0, ".", NOTDOT
    set I2, P0[I1]
    chr S31, I2
    print S31
    branch NEXT
  
  NOTDOT:
    ne S0, ",", NEXT
    readline S31, 0
    ord I2, S31
    set P0[I1], I2
    branch NEXT
  
  NEXT:
    inc I0
    le I0, I30, INTERP
    end
  
  
  
  
  
  1.11      +3 -3      parrot/config/gen/makefiles.pl
  
  Index: makefiles.pl
  ===================================================================
  RCS file: /cvs/public/parrot/config/gen/makefiles.pl,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- makefiles.pl      7 Dec 2002 14:33:11 -0000       1.10
  +++ makefiles.pl      9 Dec 2002 04:00:32 -0000       1.11
  @@ -27,7 +27,7 @@
             commentType => '#');
     genfile('config/gen/makefiles/imcc.in',      'languages/imcc/Makefile',
             commentType => '#');
  -  genfile('config/gen/makefiles/brainfuck.in', 'languages/bf/Makefile',
  +  genfile('config/gen/makefiles/bf.in',        'languages/bf/Makefile',
               commentType => '#');
            }
   
  
  
  
  1.276     +2 -2      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.275
  retrieving revision 1.276
  diff -u -w -r1.275 -r1.276
  --- MANIFEST  8 Dec 2002 18:22:26 -0000       1.275
  +++ MANIFEST  9 Dec 2002 04:00:37 -0000       1.276
  @@ -71,7 +71,7 @@
   config/gen/libparrot_def.pl
   config/gen/libparrot_def/libparrot_def.in
   config/gen/makefiles.pl
  -config/gen/makefiles/brainfuck.in
  +config/gen/makefiles/bf.in
   config/gen/makefiles/classes.in
   config/gen/makefiles/docs.in
   config/gen/makefiles/imcc.in
  @@ -1299,7 +1299,7 @@
   languages/befunge/stack.pasm
   languages/befunge/test.bef
   languages/bf/README
  -languages/bf/brainfuck.pasm
  +languages/bf/bf.pasm
   languages/bf/countdown.bf
   languages/bf/helloworld.bf
   languages/bf/test.bf
  
  
  


Reply via email to