Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

89 lines (66 sloc) 2.547 kb
This is a Befunge interpreter written in PIR.
This interpreter should be Befunge-93 compliant. This means the
playfield is limited to 80x25. This should also mean that the torus
can hold *only bytes* (that is, you can't store/fetch numbers greater
than 255 or less than 0), but actually I do not check for over /
underflow - for now.
You should compile and test the files with:
$ make test
Then you can run your Befunge program with:
$ ../../../parrot befunge.pbc [-d] foo.bef
The -d flag enables debugging within the befunge interpreter (not yet
fully implemented, this is a work in progress). Type 'help' in the
debugger to see the commands supported.
The files are the following:
befunge.pir the main loop
debug.pir routines for the debugger
flow.pir handles the flow-control instructions
io.pir handles the i/o related instructions
load.pir function to load the code from source file
maths.pir handles all the maths instructions
stack.pir handles the stack instructions
Makefile a little Makefile generated by config/makefiles/ regenerate Makefile
test.bef a befunge script that test almost all the
instructions (and is even self-modifying!)
pascserp.bef a befunge script generating variant of Sierpinsky
triangle (by Chris Pressey)
t/harness the test harness script
t/basic.t test test.bef
* pascserp.bef output is not correct (right bottom part of image is just
* more error checking
* better rand() methods
* more tests (with Perl and Test::Harness)
* debugging options (work in progress)
* implement Befunge 98
Jerome Quelin, <>
I would like to thank:
* Chris Pressey, creator of Befunge, who gave a whole new dimension to
both coding and obfuscating.
* Leon Brocard and Rafael Garcia-Suarez, for giving me this crazy
* Leon Brocard (again), because he told me he will help me with the
Befunge-98 version :o)
* Dan Sugalski and all the parrot folks (you know who you are) for
providing such a nice toy to play with.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Jump to Line
Something went wrong with that request. Please try again.