Home

Awesome

cfunge

Build status

This is cfunge - a fast Befunge93/98/109 interpreter in C.

cfunge offers some features that many other standard conforming interpreters don't. For example:

Dependencies

Required

Highly recommended

Configuring

Warning: Out of tree builds are highly recommended. Building in the source tree will not work. Building in a sub-directory of the source tree may work but is completely untested.

Warning: Only the make and ninja backends for cmake have been tested. Other backends may work, but are untested.

To build using cmake, you can run these commands in the top source directory:

$ mkdir ../build && cd ../build
$ cmake ../cfunge  # Adjust path as needed.

If you are on a 32-bit system you may want to use 32-bit integers (instead of 64-bit integers) for speed. It is also slightly faster on some 64-bit systems to use 32-bit integers. This may vary between architectures. To use 32-bit integers you could use these commands instead of the above ones:

$ mkdir ../build && cd ../build
$ cmake -DUSE_64BIT=OFF ../cfunge  # Adjust path as needed.

If you want to see a list of available options use ccmake. It will allow you to select options in a ncurses based user interface. Help is always shown at the bottom of the screen.

$ mkdir ../build && cd ../build
$ ccmake ../cfunge  # Adjust path as needed.
  (press c)
  (change options - use t to show advanced options)
  (press c again)
  (press g to generate make file)

For more information see:

$ cmake --help

and/or

$ ccmake --help

Compiling

After having run cmake as described in the above section, just run:

$ make

Installing

Not needed, cfunge can be run from build directory, but if you want to (after having compiled cfunge):

$ make install

Fingerprints

It is planned to implement most or all of the existing fingerprints, with some exceptions:

Short descriptions of implemented fingerprints:

Finger printDescription
3DSP3D space manipulation extension
BASEI/O for numbers in other bases
BOOLLogic Functions
CPLIComplex Integer extension
DATEDate Functions
DIRFDirectory functions extension
FILEFile I/O functions
FINGOperate on single fingerprint semantics
FIXPSome useful math functions
FPDPDouble precision floating point
FPSPSingle precision floating point
FRTHSome common forth commands
HRTIHigh-Resolution Timer Interface
INDVPointer functions
JSTRRead and write strings in Funge-Space
MODUModulo Arithmetic Extension
NCRSNcurses Extension
NULLFunge-98 Null Fingerprint
ORTHOrthogonal Easement Library
PERLGeneric Interface to the Perl Language
REFCReferenced Cells Extension
REXPRegular Expression Matching
ROMAFunge-98 Roman Numerals
SCKETCP/IP async socket and dns resolving extension
SOCKTCP/IP socket extension
STRNString functions
SUBRSubroutine extension
TERMTerminal control functions
TIMETime and Date functions
TOYSFunge-98 Standard Toys
TURTSimple Turtle Graphics Library

For more details please see the specs for each fingerprint. In cases of undefined behaviour in fingerprints, cfunge mostly tries to do the same thing as CCBI.

Undefined behaviour

The Befunge98 standard leaves some things undefined, here is what we do for some of those cases:

Notes on different standards

The option -s 93 does not prevent the program from accessing outside the first 80x25 cells. Nor does it disallow instructions that didn't exist in 93. It does however change space behaviour to match 93 style.

If a program depends on a instruction that is undefined in 93 to reflect, it should be easy to replace such instructions with a r for reflect or any in the range A-Z (and not load any fingerprint).

Further division by zero always returns 0 in all modes, though the Befunge93 specs says the interpreter should ask the user what result he/she wants in that situation.

Sandbox mode

Sandbox mode prevents Funge programs from doing "harmful" things, this includes, but is not limited to:

Version number scheme

cfunge uses decimal versions as of 1,0. That is, 1,15 is between 1,1 and 1,2, treating the number as a proper decimal number. In addition, the widely used (outside English that is) convention of comma (,) as the decimal separator is used instead of a period.

For the y instruction, the version number multiplied by 10000 is used. Should more than 4 decimals ever be used, the versioning scheme will change.