|
0 |
# bef(1)
|
|
1 |
|
|
2 |
### NAME
|
|
3 |
|
|
4 |
**bef** - interpret a Befunge-93 program
|
|
5 |
|
|
6 |
### SYNOPSIS
|
|
7 |
|
|
8 |
bef [-d] [-o] [-u] [-q] [-i] [-=] [-l] [-t]
|
|
9 |
[-r INPUTFILE] [-w OUTFILE] [-s STACKFILE] [-y DELAY]
|
|
10 |
BEFFILE
|
|
11 |
|
|
12 |
### DESCRIPTION
|
|
13 |
|
|
14 |
Load the file _BEFFILE_ as a Befunge-93 program and interpret it,
|
|
15 |
terminating when the Befunge-93 program terminates.
|
|
16 |
|
|
17 |
`bef` takes a few options.
|
|
18 |
|
|
19 |
-d
|
|
20 |
Run the program with a visual display of the playfield
|
|
21 |
as it runs (debugger). See IDIOSYNCRACIES below for
|
|
22 |
important notes.
|
|
23 |
|
|
24 |
-o
|
|
25 |
Old versions of `bef` contained an off-by-one error;
|
|
26 |
this flag reproduces that behaviour, should it ever
|
|
27 |
be needed to maintain backwards compatibility.
|
|
28 |
|
|
29 |
-u
|
|
30 |
Old versions of `bef` had undefined behaviour (inherited
|
|
31 |
from C) if an EOF occurred during a `&` instruction;
|
|
32 |
this flag reproduces that behaviour, should it ever
|
|
33 |
be needed to maintain backwards compatibility.
|
|
34 |
(The current behaviour is to push -1 onto the stack.)
|
|
35 |
|
|
36 |
-q
|
|
37 |
Suppress all output except for the output that the
|
|
38 |
Befunge program itself produces.
|
|
39 |
|
|
40 |
-i
|
|
41 |
Suppress the warning that is displayed when `bef`
|
|
42 |
attempts to execute an unsupported instruction.
|
|
43 |
|
|
44 |
-=
|
|
45 |
Instruct `bef` to interpret Befunge-97-style directives
|
|
46 |
embedded in the source code as directives rather than
|
|
47 |
as Befunge-93 instructions.
|
|
48 |
|
|
49 |
-l
|
|
50 |
Old versions of `bef`, when given an input program
|
|
51 |
line longer than 80 characters, would wrap it into the
|
|
52 |
next line when loading it; this flag reproduces that
|
|
53 |
behaviour, should it ever be needed to maintain
|
|
54 |
backwards compatibility. (The current behaviour is to
|
|
55 |
truncate such lines.)
|
|
56 |
|
|
57 |
-t
|
|
58 |
Old versions of `bef`, when an `#` instruction was
|
|
59 |
present at the very edge of the playfield, would wrap
|
|
60 |
inconsistently when executing it; this flag reproduces
|
|
61 |
that behaviour, should it ever be needed to maintain
|
|
62 |
backwards compatibility.
|
|
63 |
|
|
64 |
-r INPUTFILE
|
|
65 |
Have the Befunge program, when it performs input
|
|
66 |
(`~` or `&`), take that input from INPUTFILE instead
|
|
67 |
of from standard input.
|
|
68 |
|
|
69 |
-w OUTPUTFILE
|
|
70 |
Have the Befunge program, when it performs output
|
|
71 |
(`,` or `.`), send that output to OUTPUTFILE instead
|
|
72 |
of to standard output.
|
|
73 |
|
|
74 |
-s STACKFILE
|
|
75 |
As the Befunge program runs, log the contents of the
|
|
76 |
stack at each step to STACKFILE.
|
|
77 |
|
|
78 |
-y DELAY
|
|
79 |
Specify the delay, in milliseconds, between executing
|
|
80 |
each instruction, when `-d` is being used. Has no
|
|
81 |
meaning when `-d` is not being used.
|
|
82 |
|
|
83 |
### IDIOSYNCRACIES
|
|
84 |
|
|
85 |
If _BEFFILE_ does not end with a file extension, `bef` will helpfully
|
|
86 |
append `.bf` to it before trying to load it, even if a file-extensionless
|
|
87 |
file by that name exists.
|
|
88 |
|
|
89 |
In most setups, if `-d` is given, but `-w` (resp. `-r`) is not given, then
|
|
90 |
`,` and `.` (resp. `~` and `&`) will have no effect at all; in particular,
|
|
91 |
they will not pop anything or push anything onto the stack. This can
|
|
92 |
result in surprising behaviour when attempting to debug programs with I/O.
|
|
93 |
The simplest workaround is to give `-w` and `-r` options whenever the
|
|
94 |
`-d` option is used.
|
|
95 |
|
|
96 |
### AUTHOR
|
|
97 |
|
|
98 |
Originally written by Chris Pressey; bugfixes and contributions from
|
|
99 |
several contributors. See comments in the source code for more details.
|
|
100 |
|
|
101 |
### SEE ALSO
|
|
102 |
|
|
103 |
**bef2c**(1), **befprof**(1), **every other Befunge-93 implementation ever**(1)
|