Befunge Help

If anyone here knows anything about Befunge

I’m making a Befunge interpreter, and I’m a little confused on two points.

  1. How does the # command treat spaces? If I have code like this

>1# 23..@

will that 2 get skipped? That is, does # skip the next command, or just the next cell?

  1. What’s supposed to happen if a non-command character is encountered outside of string mode?

I don’t know anything about Befunge apart from a little Googling. But first, note that toy languages like this probably don’t have standards in the way that, say, ANSI C does; these probably leave a lot more up to the implementer than widespread practical languages.

This document gives an attempt at a language specification (I don’t know how widely accepted it is, and I don’t know how many other dialects there might be). With this specification, at least, (1) the 2 would not get skipped (see the description of the trampoline in the quick reference table), and (2) at least in Befunge-98, the quick reference table appears to define an action for each printable character (ASCII 32-126); the Instructions section states further that unimplemented characters should behave like the “r” (reflect) command.