2 # This file is part of Language::Befunge.
3 # Copyright (c) 2001-2008 Jerome Quelin, all rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
10 package Language
::Befunge
;
17 use Language
::Befunge
::Interpreter
;
19 # Public variables of the module.
20 our $VERSION = '4.00';
25 return Language
::Befunge
::Interpreter
->new(@_);
33 Language::Befunge - a Befunge-98 interpreter
38 use Language::Befunge;
39 my $interp = Language::Befunge->new( { file => 'program.bf' } );
40 $interp->run_code( "param", 7, "foo" );
42 Or, one can write directly:
43 my $interp = Language::Befunge->new;
44 $interp->store_code( <<'END_OF_CODE' );
52 Enter the realm of topological languages!
54 This module implements the Funge-98 specifications on a 2D field (also
55 called Befunge). It can also work as a Trefunge implementation (3D).
57 This Befunge-98 interpreters assumes the stack and Funge-Space cells
58 of this implementation are 32 bits signed integers (I hope your os
59 understand those integers). This means that the torus (or Cartesian
60 Lahey-Space topology to be more precise) looks like the following:
68 <-----------+----------->
69 -2,147,483,648 | 2,147,483,647
74 This implementation is meant to work on unix-like systems, because
75 this interpreters only handle the character which ordinal value is 10
76 (also known as \n) as an End-Of-Line chars. In particular, no warranty
77 is made neither for Microsoft systems (\r\n) nor for Macs (\r).
79 This module also implements the Concurrent Funge semantics.
84 =head2 new( [params] )
86 Call directly the Language::Befunge::Interpreter constructor. Refer to
87 L<Language::Befunge::Interpreter> for more information.
96 Write standard libraries.
103 Although this module comes with a full set of tests, maybe there are
104 subtle bugs - or maybe even I misinterpreted the Funge-98
105 specs. Please report them to me.
107 There are some bugs anyway, but they come from the specs:
113 About the 18th cell pushed by the C<y> instruction: Funge specs just
114 tell to push onto the stack the size of the stacks, but nothing is
115 said about how user will retrieve the number of stacks.
119 About the load semantics. Once a library is loaded, the interpreter is
120 to put onto the TOSS the fingerprint of the just-loaded library. But
121 nothing is said if the fingerprint is bigger than the maximum cell
122 width (here, 4 bytes). This means that libraries can't have a name
123 bigger than C<0x80000000>, ie, more than four letters with the first
124 one smaller than C<P> (C<chr(80)>).
126 Since perl is not so rigid, one can build libraries with more than
127 four letters, but perl will issue a warning about non-portability of
128 numbers greater than C<0xffffffff>.
133 =head1 ACKNOWLEDGEMENTS
135 I would like to thank Chris Pressey, creator of Befunge, who gave a
136 whole new dimension to both coding and obfuscating.
145 =item L<http://www.catseye.mb.ca/esoteric/befunge/>
147 =item L<http://dufflebunk.iwarp.com/JSFunge/spec98.html>
154 Jerome Quelin, E<lt>jquelin@cpan.orgE<gt>
156 Development is discussed on E<lt>language-befunge@mongueurs.netE<gt>
159 =head1 COPYRIGHT & LICENSE
161 Copyright (c) 2001-2008 Jerome Quelin, all rights reserved.
163 This program is free software; you can redistribute it and/or modify
164 it under the same terms as Perl itself.