Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

import following languages : bf, chitchat, forth, jako, lisp, ook, sc…

…heme & urm
  • Loading branch information...
commit 63f89e55e632e356b082745341fb4e572331c313 0 parents
@fperrad fperrad authored
4 MAINTAINER
@@ -0,0 +1,4 @@
+# $Id$
+
+N: Leon Brocard
+E: acme@astray.com
38 README
@@ -0,0 +1,38 @@
+DESCRIPTION
+
+This is a Brainfuck interpreter for Parrot. Brainfuck is a full
+computer programming language with only eight commands. For more
+information, see http://www.catseye.mb.ca/esoteric/bf/ or
+http://en.wikipedia.org/wiki/Brainfuck.
+
+To compile the files:
+
+ $ make
+
+To check that the compiler is working:
+
+ $ make test
+
+To run an example Brainfuck program:
+
+ $ ../../parrot bf.pasm helloworld.bf
+
+There is also a compiler:
+
+ $ ../../parrot bfc.pir helloworld.bf
+
+Clifford Wolf <clifford (at) clifford.at> contributed a nice bf
+program:
+
+ $ cat cw.txt
+ $ ../../parrot bf.pasm cw.bf < cw.txt > cw.c
+ $ cc -o cw cw.c
+ $ ./cw
+
+If you want to run it faster, use the bf compiler:
+
+ $ ../../parrot -j bfc.pir cw.bf < cw.txt > cw.c
+
+AUTHOR
+
+Leon Brocard <acme@astray.com>
6 bench.bf
@@ -0,0 +1,6 @@
+*LL*LH*FF*01
+>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++
+[>++++++++<-]>.[-]<<>++++++++++[>++++++++++[>++
+++++++++[>++++++++++[>++++++++++[>++++++++++[>+
++++++++++[-]<-]<-]<-]<-]<-]<-]<-]++++++++++.
+*00
135 bf.pasm
@@ -0,0 +1,135 @@
+# $Id$
+# A Brainfuck interpreter
+# By Leon Brocard <acme@astray.com>
+#
+# See http://www.catseye.mb.ca/esoteric/bf/
+# for more information on this silly language
+
+ get_params '0', P5 # P5 = @ARGV
+ # Get the brainfuck source file into S0
+ set S0, P5[1]
+ if S0, SOURCE
+usage:
+ set S0, P5[0]
+ print "usage: ./parrot "
+ print S0
+ print " file.bf\n"
+ end
+
+ # Read the file into S1
+SOURCE:
+ null I3
+ ne S0, "-O", no_o
+ set I3, 1 # optimize switch
+ set S0, P5[2]
+no_o:
+ open P1, S0, 'r'
+ defined I0, P1
+ unless I0, usage
+SOURCE_LOOP:
+ readline S2, P1
+ concat S1, S2
+ if S2, SOURCE_LOOP
+ close P1
+
+ length I30, S1
+
+ # Initialise
+
+ set I0, 0 # Our program counter
+ new P0, 'ResizableIntegerArray' # Our memory
+ set I1, 0 # Our pointer
+ getstdin P30
+
+ # The main interpreter loop
+INTERP:
+ substr S0, S1, I0, 1
+ ne S0, "+", NOTPLUS
+ set I2, P0[I1]
+ inc I2
+ band I2, 0xff
+ set P0[I1], I2
+ branch NEXT
+
+NOTPLUS:
+ ne S0, "-", NOTMINUS
+ set I2, P0[I1]
+ dec I2
+ band I2, 0xff
+ 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
+ unless I3, no_opt
+ set I2, P0[I1]
+ unless I2, NEXT
+no_opt:
+ 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
+ read S31, P30, 1
+ if S31, no_eof
+ null I2 # some return -1, some don't change data
+ branch eof
+no_eof:
+ ord I2, S31
+eof:
+ set P0[I1], I2
+ branch NEXT
+
+NEXT:
+ inc I0
+ lt I0, I30, INTERP
+ end
+
+
262 bfc.pir
@@ -0,0 +1,262 @@
+# $Id$
+# A Brainfuck compiler
+# By Leon Brocard <acme@astray.com>
+#
+# See http://www.catseye.mb.ca/esoteric/bf/
+# for more information on this silly language
+.sub _main
+ .param pmc argv
+ .local int pc
+ .local int maxpc
+ .local int label
+ .local string labelstr
+ .local string code
+ .local string filename
+ .local string file
+ .local string line
+ .local string program
+ .local string char
+
+ program = argv[0]
+ # check argc
+ $I0 = argv
+ if $I0 < 2 goto usage
+ # Get the filename
+ filename = argv[1]
+ if filename goto SOURCE
+usage:
+ print "usage: ../../parrot "
+ print program
+ print " file.bf\n"
+ end
+
+ # Read the file into S1
+SOURCE:
+ open $P1, filename, 'r'
+ defined $I0, $P1
+ if $I0, SOURCE_LOOP
+ print filename
+ print " not found\n"
+ branch usage
+SOURCE_LOOP:
+ read line, $P1, 1024
+ file = file . line
+ if line goto SOURCE_LOOP
+ close $P1
+
+ length maxpc, file
+
+ # Initialise
+ code = "set I0, 0 # pc\n"
+ # concat code, "trace 1\n"
+ concat code, "new P0, .ResizableIntegerArray # memory\n"
+ # this array doesn't support negative indices properly
+ # start with some offset
+ concat code, "set I1, 256 # pointer\n"
+ concat code, "getstdout P30\n"
+ concat code, "pop S0, P30\n # unbuffer\n"
+ concat code, "getstdin P30\n"
+
+ pc = 0 # pc
+ label = 0 # label count
+
+ # The main compiler loop
+INTERP:
+ substr_r char, file, pc, 1
+ concat code, "\nSTEP"
+ labelstr = pc
+ concat code, labelstr
+ concat code, ": # "
+ concat code, char
+ concat code, "\n"
+
+ if char != "+" goto NOTPLUS
+ .local int n_plus
+ null n_plus
+ $I0 = pc + 1
+plus_loop:
+ inc n_plus
+ if $I0 == maxpc goto emit_plus
+ substr_r char, file, $I0, 1
+ if char != "+" goto emit_plus
+ inc $I0
+ goto plus_loop
+emit_plus:
+ pc = $I0 - 1
+ concat code, "set I2, P0[I1]\n"
+ concat code, "add I2, "
+ $S0 = n_plus
+ concat code, $S0
+ concat code, "\n"
+ concat code, "band I2, 0xff\n"
+ concat code, "set P0[I1], I2\n"
+ goto NEXT
+
+NOTPLUS:
+ if char != "-" goto NOTMINUS
+ .local int n_minus
+ null n_minus
+ $I0 = pc + 1
+minus_loop:
+ inc n_minus
+ if $I0 == maxpc goto emit_minus
+ substr_r char, file, $I0, 1
+ if char != "-" goto emit_minus
+ inc $I0
+ goto minus_loop
+emit_minus:
+ pc = $I0 - 1
+ concat code, "set I2, P0[I1]\n"
+ concat code, "sub I2, "
+ $S0 = n_minus
+ concat code, $S0
+ concat code, "\n"
+ concat code, "band I2, 0xff\n"
+ concat code, "set P0[I1], I2\n"
+ goto NEXT
+
+NOTMINUS:
+ if char != ">" goto NOTGT
+ .local int n_gt
+ null n_gt
+ $I0 = pc + 1
+gt_loop:
+ inc n_gt
+ if $I0 == maxpc goto emit_gt
+ substr_r char, file, $I0, 1
+ if char != ">" goto emit_gt
+ inc $I0
+ goto gt_loop
+emit_gt:
+ pc = $I0 - 1
+ concat code, "add I1, "
+ $S0 = n_gt
+ concat code, $S0
+ concat code, "\n"
+ goto NEXT
+
+NOTGT:
+ if char != "<" goto NOTLT
+ .local int n_lt
+ null n_lt
+ $I0 = pc + 1
+lt_loop:
+ inc n_lt
+ if $I0 == maxpc goto emit_lt
+ substr_r char, file, $I0, 1
+ if char != "<" goto emit_lt
+ inc $I0
+ goto lt_loop
+emit_lt:
+ pc = $I0 - 1
+ concat code, "sub I1, "
+ $S0 = n_lt
+ concat code, $S0
+ concat code, "\n"
+ goto NEXT
+
+NOTLT:
+ if char != "[" goto NOTOPEN
+
+ .local int depth
+
+ label = pc
+OPEN_LOOP:
+ inc label
+ substr $S2, file, label, 1
+ if $S2 != "[" goto OPEN_NOTOPEN
+ inc depth
+ goto OPEN_LOOP
+OPEN_NOTOPEN:
+ if $S2 != "]" goto OPEN_LOOP
+ if depth == 0 goto OPEN_NEXT
+ dec depth
+ goto OPEN_LOOP
+OPEN_NEXT:
+ inc label
+ labelstr = label
+ concat code, "set I2, P0[I1]\n"
+ concat code, "unless I2, STEP"
+ concat code, labelstr
+ concat code, "\n"
+
+ goto NEXT
+
+NOTOPEN:
+ if char != "]" goto NOTCLOSE
+
+ label = pc
+ depth = 0 # "height"
+
+CLOSE_LOOP:
+ dec label
+ substr $S2, file, label, 1
+ if $S2 != "]" goto CLOSE_NOTCLOSE
+ inc depth
+ goto CLOSE_LOOP
+CLOSE_NOTCLOSE:
+ if $S2 != "[" goto CLOSE_LOOP
+ if depth == 0 goto CLOSE_NEXT
+ dec depth
+ goto CLOSE_LOOP
+
+CLOSE_NEXT:
+ labelstr = label
+ concat code, "branch STEP"
+ concat code, labelstr
+ concat code, "\n"
+
+ goto NEXT
+
+NOTCLOSE:
+ if char != "." goto NOTDOT
+ concat code, "set I2, P0[I1]\n"
+ concat code, "chr S31, I2\n"
+ concat code, "print S31\n"
+ goto NEXT
+
+NOTDOT:
+ if char != "," goto NEXT
+ labelstr = pc
+ concat code, "read S31, P30, 1\n"
+ concat code, "if S31, no_eof"
+ concat code, labelstr
+ concat code, "\n"
+ concat code, "null I2\n"
+ concat code, "branch eof"
+ concat code, labelstr
+ concat code, "\n"
+ concat code, "no_eof"
+ concat code, labelstr
+ concat code, ":\n"
+ concat code, "ord I2, S31\n"
+ concat code, "eof"
+ concat code, labelstr
+ concat code, ":\n"
+ concat code, "set P0[I1], I2\n"
+ goto NEXT
+
+NEXT:
+ inc pc
+
+ if pc < maxpc goto INTERP
+ labelstr = pc
+ concat code, "STEP"
+ concat code, labelstr
+ concat code, ":\n"
+ concat code, "end\n"
+
+ # printerr code
+ # printerr "\n"
+
+ # Now actually run it
+ compreg $P1, "PASM"
+ $P0 = $P1( code )
+ $P0()
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
284 bfco.pir
@@ -0,0 +1,284 @@
+# $Id$
+#
+# An Optimizing Brainfuck compiler
+# By Leo based on bfc.imc by Leon
+
+# emit register-only code
+# XXX does no register range checking
+# it runs the bench.bf 15 times faster then bfc.imc
+
+.sub main :main
+ .param pmc argv
+
+ .local int pc
+ .local int maxpc
+ .local int label
+ .local string labelstr
+ .local string code
+ .local string filename
+ .local string file
+ .local string line
+ .local string program
+ .local string char
+
+ program = argv[0]
+ # check argc
+ $I0 = argv
+ if $I0 < 2 goto usage
+ # Get the filename
+ filename = argv[1]
+ if filename goto SOURCE
+usage:
+ print "usage: ../../parrot "
+ print program
+ print " file.bf\n"
+ end
+
+ # Read the file into S1
+SOURCE:
+ open $P1, filename, 'r'
+ defined $I0, $P1
+ if $I0, SOURCE_LOOP
+ print filename
+ print " not found\n"
+ branch usage
+SOURCE_LOOP:
+ read line, $P1, 1024
+ file = file . line
+ if line goto SOURCE_LOOP
+ close $P1
+
+ maxpc = length file
+
+ # Initialise
+ code = "# Code generated by bfco.pir\n"
+ # concat code, "trace 1\n"
+ concat code, "new P0, 'ResizableIntegerArray' # memory\n"
+ # this array doesn't support negative indices properly
+ # start with some offset
+ concat code, "getstdout P30\n"
+ concat code, "pop S0, P30\n # unbuffer\n"
+ concat code, "getstdin P30\n"
+
+ pc = 0 # pc
+ label = 0 # label count
+ .local int depth, n_lt, n_gt, reg
+ reg = 0
+ concat code, " cleari\n"
+
+ # The main compiler loop
+INTERP:
+ substr_r char, file, pc, 1
+ concat code, "\nSTEP"
+ labelstr = pc
+ concat code, labelstr
+ concat code, ": # "
+ concat code, char
+ concat code, "\n"
+
+ if char != "+" goto NOTPLUS
+ .local int n_plus
+ null n_plus
+ $I0 = pc + 1
+plus_loop:
+ inc n_plus
+ if $I0 == maxpc goto emit_plus
+ substr_r char, file, $I0, 1
+ if char != "+" goto emit_plus
+ inc $I0
+ goto plus_loop
+emit_plus:
+ pc = $I0 - 1
+ concat code, " add I"
+ set $S1, reg
+ concat code, $S1
+ concat code, ", "
+ $S0 = n_plus
+ concat code, $S0
+ concat code, "\n"
+ concat code, " band I"
+ concat code, $S1
+ concat code, ", 0xff\n"
+ goto NEXT
+
+NOTPLUS:
+ if char != "-" goto NOTMINUS
+ .local int n_minus
+ null n_minus
+ $I0 = pc + 1
+minus_loop:
+ inc n_minus
+ if $I0 == maxpc goto emit_minus
+ substr_r char, file, $I0, 1
+ if char != "-" goto emit_minus
+ inc $I0
+ goto minus_loop
+emit_minus:
+ pc = $I0 - 1
+ concat code, " sub I"
+ set $S1, reg
+ concat code, $S1
+ concat code, ", "
+ $S0 = n_minus
+ concat code, $S0
+ concat code, "\n"
+ concat code, " band I"
+ concat code, $S1
+ concat code, ", 0xff\n"
+ goto NEXT
+
+NOTMINUS:
+ if char != ">" goto NOTGT
+
+ null n_gt
+ $I0 = pc + 1
+gt_loop:
+ inc n_gt
+ if $I0 == maxpc goto emit_gt
+ substr_r char, file, $I0, 1
+ if char != ">" goto emit_gt
+ inc $I0
+ goto gt_loop
+emit_gt:
+ reg += n_gt
+ bsr debug
+ pc = $I0 - 1
+ goto NEXT
+
+NOTGT:
+ if char != "<" goto NOTLT
+ null n_lt
+ $I0 = pc + 1
+lt_loop:
+ inc n_lt
+ if $I0 == maxpc goto emit_lt
+ substr_r char, file, $I0, 1
+ if char != "<" goto emit_lt
+ inc $I0
+ goto lt_loop
+emit_lt:
+ reg -= n_lt
+ bsr debug
+ pc = $I0 - 1
+ goto NEXT
+
+NOTLT:
+ if char != "[" goto NOTOPEN
+
+ label = pc
+ depth = 0
+OPEN_LOOP:
+ inc label
+ substr $S2, file, label, 1
+ if $S2 != "[" goto OPEN_NOTOPEN
+ inc depth
+ goto OPEN_LOOP
+OPEN_NOTOPEN:
+ if $S2 != "]" goto OPEN_LOOP
+ if depth == 0 goto OPEN_NEXT
+ dec depth
+ goto OPEN_LOOP
+OPEN_NEXT:
+ inc label
+ labelstr = label
+ concat code, " unless I"
+ set $S0, reg
+ concat code, $S0
+ concat code, ", STEP"
+ concat code, labelstr
+ concat code, "\n"
+
+ goto NEXT
+
+NOTOPEN:
+ if char != "]" goto NOTCLOSE
+
+ label = pc
+ depth = 0 # "height"
+
+CLOSE_LOOP:
+ dec label
+ substr $S2, file, label, 1
+ if $S2 != "]" goto CLOSE_NOTCLOSE
+ inc depth
+ goto CLOSE_LOOP
+CLOSE_NOTCLOSE:
+ if $S2 != "[" goto CLOSE_LOOP
+ if depth == 0 goto CLOSE_NEXT
+ dec depth
+ goto CLOSE_LOOP
+
+CLOSE_NEXT:
+ labelstr = label
+ concat code, " branch STEP"
+ concat code, labelstr
+ concat code, "\n"
+
+ goto NEXT
+
+NOTCLOSE:
+ if char != "." goto NOTDOT
+ concat code, " chr S31, I"
+ $S0 = reg
+ concat code, $S0
+ concat code, "\n"
+ concat code, " print S31\n"
+ goto NEXT
+
+NOTDOT:
+ if char != "," goto NEXT
+ labelstr = pc
+ concat code, " read S31, P30, 1\n"
+ concat code, " if S31, no_eof"
+ concat code, labelstr
+ concat code, "\n"
+ concat code, " null I31\n"
+ concat code, " branch eof"
+ concat code, labelstr
+ concat code, "\n"
+ concat code, "no_eof"
+ concat code, labelstr
+ concat code, ":\n"
+ concat code, " ord I31, S31\n"
+ concat code, "eof"
+ concat code, labelstr
+ concat code, ":\n"
+ $S0 = reg
+ concat code, " set I"
+ concat code, $S0
+ concat code, ", I31\n"
+ goto NEXT
+
+NEXT:
+ inc pc
+
+ if pc < maxpc goto INTERP
+ labelstr = pc
+ concat code, "STEP"
+ concat code, labelstr
+ concat code, ":\n"
+ concat code, "end\n"
+
+ # Now actually run it
+ $P1 = compreg "PASM"
+ $P0 = $P1( code )
+ $P0()
+ end
+
+debug:
+ ret
+ concat code, "# depth "
+ $S0 = depth
+ concat code, $S0
+ concat code, " reg "
+ $S0 = reg
+ concat code, $S0
+ concat code, "\n"
+ ret
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
51 config/makefiles/root.in
@@ -0,0 +1,51 @@
+# Copyright (C) 2002-2009, Parrot Foundation.
+# $Id$
+
+RM_F = @rm_f@
+PERL = @perl@
+PARROT=../../parrot
+#CONDITIONED_LINE(darwin):
+#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
+#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
+
+default: build
+
+help :
+ @echo ""
+ @echo "Following targets are available for the user:"
+ @echo ""
+ @echo " build: build bf.pbc and bfc.pir"
+ @echo " This is the default."
+ @echo ""
+ @echo " test: run the test suite,"
+ @echo ""
+ @echo " clean: clean up temporary files"
+ @echo ""
+ @echo " realclean: clean up generated files"
+ @echo ""
+ @echo " help: print this help message"
+
+test: build
+ $(PERL) -Ilib -I../../lib t/harness
+
+build: bf.pbc bfc.pbc bfco.pbc
+
+bf.pbc: bf.pasm
+ $(PARROT) -o bf.pbc bf.pasm
+
+bfc.pbc: bfc.pir
+ $(PARROT) -o bfc.pbc bfc.pir
+
+bfco.pbc: bfco.pir
+ $(PARROT) -o bfco.pbc bfco.pir
+
+clean:
+ $(RM_F) core "*.pbc" "*~"
+
+realclean: clean
+ $(RM_F) Makefile
+
+# Local variables:
+# mode: makefile
+# End:
+# vim: ft=make:
3  countdown.bf
@@ -0,0 +1,3 @@
+++++++++++++++++++++++++++++++++[>+>+<<-]
+>>+++++++++++++++++++++++++<<
+++++++++++[>>.-<.<-]
46 cw.bf
@@ -0,0 +1,46 @@
+>>+++[<+++++[<+++++++>-]>-]<<.>>>+++++[<+++++++++++[<++>-]>-]<<.>++++>
+>++++[<++++[<+++++++>-]>-]<<.>++>+++++[<++++++>-]<.>+>>++++[<+++++++++
+[<+++>-]>-]<<.>+>>++++[<++++[<++++++>-]>-]<<.<<<<<.>.>>>>>+>++++++++++
++++[<+++>-]<.>++>+++++++++++++[<+++>-]<.>++>+++++++++++[<+++++++++++>-
+]<.>>+++++++++[<+++++++++++>-]<.>++>+++++++++++++++++[<++++++>-]<.<<<<
+<.>>>>>>++>>++++[<++++[<+++++++>-]>-]<<.>>+++++++[<++++++>-]<.<<<<<<<.
+>>>>>>>>+>>++++[<+++++[<+++>-]>-]<<.>+>+++++++++++[<+++>-]<.>+[[-]>,[>
++>[-]+>+<<<-]>>[[-]>+[<[-]+>-]<[<<<+>>>[-]]]>[-]<<[>+>+<<-]>[<+>-]+>--
+--------[<[-]>[-]]<[-<<+>>]<[>+>+<<-]>[<+>-]+>-->+++++[<------>-]<[<[-
+]>[-]]<[-<<++>>]<[>+>+<<-]>[<+>-]+>-->+++++++++[<----->-]<[<[-]>[-]]<[
+-<<+++>>]<[>+>+<<-]>[<+>-]+>>+++++[<------------------->-]<[<[-]>[-]]<
+[-<<++++>>]<[>+>+<<-]>[<+>-]+>->+++++++[<------------->-]<[<[-]>[-]]<[
+-<<+++++>>]<[>+>+<<-]>[<+>-]+>--->+++++++++++[<----------->-]<[<[-]>[-
+]]<[-<<++++++>>]<[-]>[-],[>+>+<<-]>[<+>-]+>----------[<[-]>[-]]<[-<<+>
+>]<[>+>+<<-]>[<+>-]+>-->+++++[<------>-]<[<[-]>[-]]<[-<<++>>]<[>+>+<<-
+]>[<+>-]+>-->+++++++++[<----->-]<[<[-]>[-]]<[-<<+++>>]<[>+>+<<-]>[<+>-
+]+>>+++++[<------------------->-]<[<[-]>[-]]<[-<<++++>>]<[>+>+<<-]>[<+
+>-]+>->+++++++[<------------->-]<[<[-]>[-]]<[-<<+++++>>]<[>+>+<<-]>[<+
+>-]+>--->+++++++++++[<----------->-]<[<[-]>[-]]<[-<<++++++>>]<[-]<[->+
+<]>[-<+++++++>]<[-<+>]<>+++++[<+++++++>-]<<[>.>+<<[-]]>[-]>[-<<+>>]<<]
+<.>>>>>++++[<+++++++++++>-]<.<<<<<<.>>>>>>>>>+++++++[<+++++++[<++>-]>-
+]<<.<<<<<<.>.>>>>>>>+++++++++[<+++++++>-]<.>+>+++++++[<+++++++++++++>-
+]<.<<<<<<<<<<<<<<<<<<<<.>>.>>>>>>>>>>>>>>>>>>>++>+++++++++[<+++++>-]<.
+>>+++++[<+++++++++++++++++++>-]<.<<..>>>+++>+++++++++++[<+++++++++++>-
+]<.<<<<<<<<<<.>>>>>>>>>>>++++>+++++[<+++++++++++>-]<.>>+++++++[<++++++
++++++++++++>-]<.<<<<<<<<<<<<<<<<.<<<<<<<<<<.>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>++++[<+++++++++[<+++>-]>-]<<.>+>>++++[<+++++[<+++++>-]>-]<<.<<<<<<<
+<<<<<<<<<<<<<<<.>>>>>>.<<<<<<<.>>.>.>>>>>>>>>>>>>>>>>>>>>>>++++[<++++[
+<+++++++>-]>-]<<.>>+++++++++[<+++++++++++++>-]<.<<<<<<<<<<<<<<<<<<<<<<
+<<<<<<.>>>>>>>.>.<<<<<.>>>>>>.<<<<<.>>>>>>>>>>>>>.>>>>>>>>>>>>>+++++++
+[<+++++++++++++>-]<.<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>.<<<<<<<.>>>>>>>>>
+>>>>>>>>>>>>>>>>>>>+++++++++[<+++++>-]<.>>+++++++++++++[<+++>-]<.>>+++
+++[<+++++++>-]<.<.<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>+>++++[<+++++++++>-]<.>>+++++[<+++++++++++>-]<.>++>+++++++[<+++++++
+++++++>-]<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>>>.>>>>.>.<<
+<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>.>.<<<<<.>>>>>>.<<<<<.>>>>>>>>>>>>>.
+>>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>.<<<<<<.<.>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>>>>+>+++++++[<++++++>-]<..<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+<<.>>>>>>>>>>>>>>>>>>>>>>>>>.>>>>>>>++>+++++++[<+++++++>-]<.>+>++++[<+
+++++++++++++>-]<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>.>>>
+>>>>>>>>>>>.>.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>>>.>>>>>>
+>>>>>>>>>>>>+++++[<+++++[<+++++>-]>-]<<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+.>>>>>>>>>>>>>>>>>.<<<<<<<<<<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>.<<<<<<<<<<<<<<<<<<<.<<<<<<<<<<.>>.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+>>>>>>>>+++>+++++++++[<+++++>-]<.<<<<<<<<<<<<<<<<<.>>>>>>>>>>>>>>>>.>>
+++++++++++.
6 cw.txt
@@ -0,0 +1,6 @@
+ ____ _ _ __ __ _ _ _ _ ___ _____
+ / ___| |__ __ _ ___ ___| |_ _ __ ___ / _|/ _| / / | / / | / _ \___ /
+| | | _ \ / _| |/ _ \/ __| __| |__/ _ \ |_| |_ | | | | | || | | ||_ \
+| |___| | | | |_| | |_| \__ \ |_| | | __/ _| _| | | |_| | || |_| |__| |
+ \____|_| |_|\__|_|\___/|___/\__|_| \___|_| |_| |_|_|_|_|_|_\___/____/
+
3  helloworld.bf
@@ -0,0 +1,3 @@
+>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-]
+<.>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]>++++++++[
+<++++>-]<+.[-]++++++++++.
31 t/harness
@@ -0,0 +1,31 @@
+#! perl
+
+# $Id$
+
+=head1 NAME
+
+languages/bf/t/harness - A harness for bf
+
+=head1 SYNOPSIS
+
+ cd languages && perl -I../lib bf/t/harness --files
+
+ cd languages && perl -I../lib bf/t/harness
+
+ cd languages && perl -I../lib bf/t/harness \
+ bf/t/test_bf.t \
+ bf/t/test_bfc.t
+
+=head1 DESCRIPTION
+
+If I'm called with a single
+argument of "--files", I just return a list of files to process.
+This list is one per line, and is relative to the languages dir.
+
+If I'm called with no args, I run the complete suite.
+
+Otherwise I run the tests that were passed on the command line.
+
+=cut
+
+use Parrot::Test::Harness language => 'bf';
6 t/test_bf.t
@@ -0,0 +1,6 @@
+# $Id$
+
+# Test bf compiler
+# Print TAP, Test Anything Protocol
+
+system( "../parrot -r bf/bf.pbc bf/test.bf" );
6 t/test_bfc.t
@@ -0,0 +1,6 @@
+# $Id$
+
+# Test bf interpreter
+# Print TAP, Test Anything Protocol
+
+system( "../parrot -r bf/bfc.pbc bf/test.bf" );
6 t/test_bfco.t
@@ -0,0 +1,6 @@
+# $Id$
+
+# Test bf interpreter
+# Print TAP, Test Anything Protocol
+
+system( "../parrot -r bf/bfco.pbc bf/test.bf" );
11 test.bf
@@ -0,0 +1,11 @@
+Simple TAP style test script by Leon Brocard acme@astray DOT com
++++++++++++++++++++++++++++++++++++++++++++++++++.
+---.
+.
++++.
+---------------------------------------.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
+----.
+---------------------------------------------------------------------------.
++++++++++++++++++.
+---------------------------------------.
Please sign in to comment.
Something went wrong with that request. Please try again.