"Stinkhorn" Befunge-98 and Trefunge-98 interpreter

  1. Main section
  2. Downloads
  3. Supported fingerprints
  4. Usage
  5. Debugger
  6. Building
  7. Recent changes

I have resumed working on my old befunge-98 interpreter, which is undergoing changes for better compliance, performance, and features. I'm using the mycology test suite, which has proven very helpful so far in finding bugs.

Currently the following features are not supported: concurrent funge-98, exec, and quite a few fingerprints. I'll support whatever fingerprints I can shoehorn in, but don't expect TRDS to work any time soon. A CLI debugger is now included, although it still needs work. The debugger supports positional breakpoints, breakpoints based on what code is about to execute, and should shortly support more types of breakpoints.

The stinkhorn befunge-98 interpreter is currently all written in C++, and compiles under Visual C++ or G++. It supports befunge and trefunge, and cell sizes of 32 and 64 bits, both of which may be specified at run time. It is also possible to remove support for individual configurations at compile-time. See the usage section for details.

The two main goals are for it to comply with the Funge-98 specification, and be reasonably fast. Complete compliance will probably never happen, but I can try — it is especially difficult where the specification is not very clear on what the behaviour of an instruction should be. There is a reasonably infrequently updated source repository at http://svn.asztal.net/befunge98/.

The interpreter has a handprint of 0x5E5F5F5E. It's probably called “Stinkhorn”.


Downloads

If you don't trust me or want a different version, build your own

Supported Fingerprints:


Using stinkhorn

$ ./stinkhorn  --help
General options:
  --help [ -h ]           produce help message
  --version [ -v ]        produce version message
  --warnings [ -w ]       turn on warnings
  --befunge-93 [ -93 ]    befunge-93 compatibility
  --cell-size [ -B ] arg  change the cell size (default 32)
  --trefunge [ -3 ]       use trefunge instead of befunge
  --source-line [ -S ]    specifies the source code inline, instead of reading
                          from a file. May be specified again to specify the
                          next line of the source. Note: ^, <, > and " must
                          usually be escaped.
  --show-source-lines     useful for debugging --source-line
  --debug [ -d ]          attach debugger
  --bench [ -b ]          benchmark by running until 2 seconds has elapsed
  --benchn arg            benchmark by running the given number of times

How to build

First of all, the boost c++ library is required (you don't need to actually build it, though, only the headers are used). To build: on windows, with Visual Studio, build the MSVC project; on anything else, g++ -o stinkhorn -O2 *.cpp. If it doesn't build with your compiler, it's probably because I've written non-standard C++ and not noticed because of lenient compilers. Please feel free to tell me if this happens.

Using the debugger

To use the debugger, pass the -d argument to the interpreter. Once inside the debugger, use the help command to obtain a list of commands and help command to obtain information about a particular command (note: it may not be very useful information).

The list (or just l) command shows the fungespace at a given point (which defaults to where the current IP is). The size of the output of list is configurable using the listsize command. The output of list should look something like what is shown above if you have images enabled. The IP's current position is shown by the "crosshair" of yellow characters surrounding it, the IP's recent positions are shown in magenta, and the predicted next instruction is red. This gives a vaguely usable visual indication of the IP's position and direction. The yellow crosshair will probably change to some other indication in the future, since it kind of sucks.

The debugger doesn't currently support multiple threads, but that's OK, since the normal interpreter doesn't do that yet either. All in good time.


Recent changes

2008-11-01

2008-10-29 (r45)

2008-10-14

2008-10-12 (r31-38)