bf v0.9.4 QUICK REFERENCE VOCABULARY
Language keychars
-----------------
! exclamation mark ( a v - ) - store a into v (no chars between v and !)
: colon ( v - a ) - leave v content on TOS (no chars between v and :)
@ at ( [f] | v - x*a ) - execute function [f] on TOS or in variable v
? query ( f [f] - x*a ) - if-then; execute [f] if f
( f [f1] [f2] - x*a ) - if-then-else; execute [f1] if f, or else [f2]
# sharp ( [f1] [f2] - x*a ) - while cycle; while [f1] execute [f2]
d ( n2 n1 [f] - x*a ) - do loop cycle; execute [f] n2 - n1 times
( n2 n1 [f1] [f2] - x*a ) - do +loop; [f1] must leave a signed integer
: colon ( - i ) - if used inside a loop, leave current loop index on TOS
h halt cycle; must be used into [f2] of # and d, (see while and do-loop)
% percent ( a - a a ) - dup
; semi-colon ( a - ) - drop
$ dollar ( a1 a2 - a2 a1 ) - swap
_ underscore ( a3 a2 a1 - a2 a1 a3 ) - rot
r ( x*a i - y*a ) - roll, rotate ith element
p ( x*a i - x*a a ) - pick, copy ith element
: colon - show stack (it must be preceeded by any non-alphabetic char)
e ( x*a - ) - empty stack
} right curly bracket ( - i ) - leave current stack depth
g ( i1 - i2 | ) - leave random number between 0 and i1, or set seed if i1 = 0
* star ( n1 n2 - n1*n2 ) - (integer) multiplication
+ plus ( n1 n2 - n1+n2 ) - (integer) addition
- dash ( n1 n2 - n1-n2 ) - (integer) subtraction
/ slash ( n1 n2 - n1/n2 ) - (integer) division
m ( n1 n2 - i ) - modulo (integer remainder of n1/n2)
^ caret ( n1 n2 - n3 ) - leave n1 to the power of n2
! exclamation mark ( n1 n2 - n3 ) - leave n1 to the root of n2
\ backslash ( n - -n ) - negate TOS
= equal ( a1 a2 - f ) - True if a1 = a2
> greater than ( a1 a2 - f ) - True if a1 > a2
& ampersand ( i1 i2 - f ) - logical and
| bar ( i1 i2 - f ) - logical or
~ tilde ( f1 - f2 ) - logical not
s ( n - d ) - sin (n in radians)
c ( n - d ) - cos (n in radians)
t ( n - d ) - arctan (n in radians)
l letter l ( n1 n2 - n3 ) - leave logarithm in base n2 of n1
a ( i1 i2 - i3 ) - bitwise and
o ( i1 i2 - i3 ) - bitwise or
n ( i1 - i2 ) - bitwise not (1s complement)
x ( i1 i2 - i3 ) - bitwise xor
v ( i - d | d - i ) - convert an integer to a float and vice versa
( "s" - [f] | [f] - "s" ) - convert a string to a function and vice versa
, comma ( "s" - n ) - convert string on TOS to number (integer or float)
( n - "s" ) - convert number on TOS (integer or float) to string
i ( a - ) - print TOS on standard output
j ( a i - ) - print a in a field of i chars on standard output (space padded)
k ( n i - ) - if i >= 0, print n with i decimal digits (zero padded)
( d i - ) - if i < 0, possibily, print d with |i| digits (exponential form)
. dot - emit a Carriage Return
< lesser than ( - "s" ) - read from standard input leaving string "s"
( left paren ( "f" - x*a ) - include file "f" and execute it
( "f" i - "s" ) - if i > 0 leave ith line of file "f" as "s"
( "f" i - [f] ) - if i < 0 leave ith line of file "f" as [f]
( "f" 0 - i ) - leave number of lines of text file "f"
) right paren ( "f" "s" - ) - append string "s" to file "f"
( "f" 0 - ) - empty file "f" (set it to zero length)
f ( - "f" ) - leave current buffer file name
b ( "f" - ) - set buffer file name to "f"
y ( "f" - ) - yield stack content, in bf format, to file "f"
] right square bracket - toggle appending input lines to buffer file
` grave ( - c ) - leave on TOS ASCII code of next char
' tick ( c - ) - print char whose ASCII code is on TOS
u ( "s" - c ) - unveil first ASCII code of string "s", leaving it on TOS
( "s1" i1 i2 - "s2" ) - leave substring "s2" of "s1", from i1 > 0 to i2
( "s" i1 - i2 ) - if i1 < 0, leave length of string "s"
( "s1" "s2" 0 - "s1+s2" ) - leave union of strings "s1" and "s2"
~ tilde ( - yyyy mm dd ) - followed by d leave date values on stack
( - hh mm ss ) - followed by t leave time values on stack
( a - ) ( R: - a ) - followed by > move TOS to return stack
( - a ) ( R: a - ) - followed by < move top of return stack to TOS
( - a ) ( R: a - a ) - followed by : copy top of return stack to TOS
" quote ( - "s" ) start a string until first " or EOL; \ escapes "
[ left square bracket ( - [f] ) start a function until last ] or EOL
{ left curly bracket - start skipping text (comments) until first } or EOL
w ( a - i ) leave token of a (0 = int; 1 = float; 4 = string; 5 = function)
Debugging commands
------------------
debug toggle on/off debugging
see ( - ) show instructions linked to most recent
voc print a list of all defined words
where print value of all non null variables
System flag commands
------------------
clearonerror ( - ) toggle on/off stack clearing on error
errorshow ( - ) toggle on/off error showing
exitwarn ( - ) toggle on/off exit warninf on stack not empty
quiet ( - ) toggle on/off quiet mode
System commands
---------------
bye the same as 0q (also exit, halt, quit)
cd ( "s" - ) change to directory "s"
def ( - ) - link to the
following it until EOL; is then stored into vocabulary
edit ( "f" - ) edit file "f" with an editor (set in bf.h)
help help on system commands
ls list current directory (also dir)
now print current date & time in C format
precision ( i1 - ) | ( 0 - i2 ) set/get max precision for floats
pwd print working directory
q ( n - ) quit with error code n (0 means success)
ref show a quick language summary by screens (also words)
reset reset all variables, erase all defined words and clear stack
savedef ( "f" - ) save an image of defined words on file "f"
savesys ( "f" - ) execute savedef + savevar on file "f"
savevar ( "f" - ) save an image of variables on file "f"
sh ( - ) execute shell command starting from next char to EOL
show ( "f" - ) show content of file "f" using a pager (also view)
status show some information about the running bf session
undef ( - ) - removes from the vocabulary
version ( - "s" ) - leave a string with the version number
               (
geocities.com/it/tonibin/bf)                   (
geocities.com/it/tonibin)                   (
geocities.com/it)