F♭ (pronounced F-flat) is a toy language.
Converts a stack item to a “function” definition
defer
Stores a value in the dictionary that raises an error when executed. Used to allocate a word before it is used, for example in mutually-recursive
a: ->
f♭> a: defer
[ ]
;
(def)stores a definition in the current dictionary
a: [A] ->
f♭> sqr: [ dup * ] ;
[ ]
use
Move the contents of a map into scope
vocab
{A} ->
f♭> { ... } use
[ ]
vocab
Write the current local vocabulary to the stack
-> {A}
f♭> vocab
[ { ... } ]
defined?
returns true if the word is defined in the current vocabulary
a: -> bool
f♭> 'sqr' defined?
[ true ]
see
recalls the definition of a word as a string
a: -> str
f♭> 'sqr' see
[ '[ dup * ]' ]
show
prints the definition of a word as a formatted string
a: ->
f♭> "sqr" show
[ dup * ]
[ ]
words
-> [str*]
returns a list of defined words
locals
-> [str*]
returns a list of locals words
scoped
-> [str*]
returns a list of local scoped words
rewrite
{A} [B] -> [C]
rewrites an expression using a set of rewrite rules