factor/library/vocabularies.facts

84 lines
4.0 KiB
Plaintext

USING: help parser words ;
HELP: bootstrapping? f
{ $description "Variable. Set by the library while bootstrap is in progress. Some parsing words need to behave differently during bootstrap." } ;
HELP: vocabularies f
{ $description "Variable. Holds a hashtable mapping vocabulary names to vocabularies." } ;
HELP: word "( -- word )"
{ $values { "word" "a word" } }
{ $description "Outputs the most recently defined word." }
{ $see-also save-location } ;
HELP: set-word "( -- word )"
{ $values { "word" "a word" } }
{ $description "Sets the recently defined word. Usually you would call " { $link save-location } " on a newly-defined word instead, which will in turn call this word." }
{ $see-also word } ;
HELP: vocabs "( -- seq )"
{ $values { "word" "a sequence of strings" } }
{ $description "Outputs a sequence of all defined vocabulary names." } ;
HELP: vocab "( name -- vocab )"
{ $values { "name" "a string" } { "vocab" "a hashtable" } }
{ $description "Outputs a named vocabulary, or " { $link f } " if no vocabulary with this name exists." } ;
HELP: ensure-vocab "( name -- )"
{ $values { "name" "a string" } }
{ $description "Creates a vocabulary if it does not already exist." } ;
HELP: words "( vocab -- seq )"
{ $values { "vocab" "a string" } { "seq" "a sequence of words" } }
{ $description "Outputs a sequence of words defined in the vocabulary, or " { $link f } " if no vocabulary with this name exists." } ;
HELP: all-words "( -- seq )"
{ $values { "seq" "a sequence of words" } }
{ $description "Outputs a sequence of all words in the dictionary." } ;
HELP: each-word "( quot -- )"
{ $values { "quot" "a quotation with stack effect " { $snippet "( word -- )" } } }
{ $description "Applies a quotation to each word in the dictionary." } ;
HELP: word-subset "( quot -- seq )"
{ $values { "quot" "a quotation with stack effect " { $snippet "( word -- ? )" } } { "seq" "a sequence of words" } }
{ $description "Outputs a sequence of words satisfying the predicate." } ;
HELP: recrossref "( -- )"
{ $description "Update the word dependency database. Usually this is done automatically." } ;
HELP: lookup "( name vocab -- word )"
{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word or " { $link f } } }
{ $description "Looks up a word in the dictionary. If the vocabulary or the word is not defined, outputs " { $link f } "." } ;
HELP: reveal "( word -- )"
{ $values { "word" "a word" } }
{ $description "Adds a newly-created word to the dictionary. Usually this word does not need to be called directly." }
{ $see-also create } ;
HELP: create "( name vocab -- word )"
{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word" } }
{ $description "Creates a new word. Creates the vocabulary first if it does not already exist. If the vocabulary exists and already contains a word with the requested name, outputs the existing word." } ;
HELP: constructor-word "( name vocab -- word )"
{ $values { "name" "a string" } { "vocab" "a string" } { "word" "a word" } }
{ $description "Creates a new word, surrounding " { $snippet "name" } " in angle brackets." }
{ $examples { $example "\"salmon\" \"scratchpad\" constructor-word ." "<salmon>" } } ;
HELP: forget "( word -- )"
{ $values { "word" "a word" } }
{ $description "Removes the word from its vocabulary. The word becomes uninterned." }
{ $see-also POSTPONE: FORGET: } ;
HELP: target-word "( word -- target )"
{ $values { "word" "a word" } { "target" "a word" } }
{ $description "Looks up a word with the same name and vocabulary as the given word. Used during bootstrap to transfer host words to the target dictionary." } ;
HELP: interned? "( word -- ? )"
{ $values { "word" "a word" } { "?" "a boolean" } }
{ $description "Test if the word is an interned word." } ;
HELP: bootstrap-word "( word -- target )"
{ $values { "word" "a word" } { "target" "a word" } }
{ $description "Looks up a word with the same name and vocabulary as the given word, performing a transformation to handle parsing words in the target dictionary. Used during bootstrap to transfer host words to the target dictionary." } ;