NAME

Language::Befunge - a Befunge-98 interpreter.

SYNOPSIS

use Language::Befunge;
read_file( "program.bf" );
run_code;

Or, one can write directly:
store_code( <<'END_OF_CODE' );
v @,,,,"foo"a <
>             ^
END_OF_CODE
run_code;

DESCRIPTION

Enter the realm of topological languages!

This module implements the Funge-98 specifications on a 2D field (also called Befunge). In particular, be aware that this is not a Trefunge implementation (3D).

This Befunge-98 interpreters assumes the stack and Funge-Space cells of this implementation are 32 bits signed integers (I hope your os understand those integers). This means that the torus (or Cartesian Lahey-Space topology to be more precise) looks like the following:

            32-bit Befunge-98
            =================
                    ^
                    |-2,147,483,648
                    |
                    |         x
        <-----------+----------->
-2,147,483,648      |      2,147,483,647
                    |
                   y|2,147,483,647
                    v

This implementation is meant to work on unix-like systems, because this interpreters only handle the character which ordinal value is 10 (also known as \n) as an End-Of-Line chars. In particular, no warranty is made neither for Microsoft systems (\r\n) nor for Macs (\r).

PRIVATE FUNCTIONS

debug( )

Output debug messages.

EXPORTED FUNCTIONS

read_file( filename )

Read a file (given as argument) and store its code.

Side effect: clear the previous code.

store_code( code )

Store the given code in the Lahey space.

Side effect: clear the previous code.

run_code( )

Run the current code. That is, create a new Instruction Pointer and move it around the code.

Return the exit code of the program.

AUTHOR

Jerome Quelin, <jquelin@cpan.org>

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl
http://www.catseye.mb.ca/esoteric/befunge/
http://dufflebunk.iwarp.com/JSFunge/spec98.html