Document 'boot' word, minor cookbook update
parent
38bdb4f85a
commit
11479efbc2
|
@ -1,4 +1,5 @@
|
|||
USING: help io kernel math namespaces prettyprint sequences ;
|
||||
USING: help io kernel math namespaces parser prettyprint
|
||||
sequences ;
|
||||
|
||||
ARTICLE: "cookbook-syntax" "Basic syntax cookbook"
|
||||
"The following is a simple snippet of Factor code:"
|
||||
|
@ -141,7 +142,7 @@ ARTICLE: "cookbook-variables" "Variables cookbook"
|
|||
"namespaces"
|
||||
} ;
|
||||
|
||||
ARTICLE: "cookbook-vocabs" "Vocabularies and source files cookbook"
|
||||
ARTICLE: "cookbook-vocabs" "Vocabularies cookbook"
|
||||
"Rather than being in one flat list, words belong to vocabularies; every word is contained in exactly one. When parsing a word name, the parser searches the " { $emphasis "vocabulary search path" } ". When working at the listener, a useful set of vocabularies is already available. In a source file, all used vocabularies must be imported."
|
||||
$terpri
|
||||
"For example, a source file containing the following code will print a parse error if you try loading it:"
|
||||
|
@ -172,6 +173,16 @@ $terpri
|
|||
"parser"
|
||||
} ;
|
||||
|
||||
ARTICLE: "cookbook-sources" "Source file cookbook"
|
||||
"By convention, code is stored in files with the " { $snippet ".factor" } " filename extension. You can load source files using " { $link run-file } ":"
|
||||
{ $code "\"hello.factor\" run-file" }
|
||||
"You can load source files from the Factor source code directory using " { $link run-resource } ":"
|
||||
{ $code "\"/examples/lcd.factor\" run-resource" }
|
||||
{ $references
|
||||
"You can learn more about parsing external content:"
|
||||
"parse-stream"
|
||||
} ;
|
||||
|
||||
ARTICLE: "cookbook-io" "I/O cookbook"
|
||||
"Ask the user for their age, and print it back:"
|
||||
{ $code
|
||||
|
|
|
@ -16,6 +16,7 @@ ARTICLE: "handbook" "Factor documentation"
|
|||
{ $subsection "cookbook-combinators" }
|
||||
{ $subsection "cookbook-variables" }
|
||||
{ $subsection "cookbook-vocabs" }
|
||||
{ $subsection "cookbook-sources" }
|
||||
{ $subsection "cookbook-io" }
|
||||
{ $heading "Language reference" }
|
||||
{ $subsection "conventions" }
|
||||
|
|
|
@ -32,6 +32,8 @@ ARTICLE: "searching-help-impl" "Full-text search implementation"
|
|||
{ $subsection index-text } ;
|
||||
|
||||
ARTICLE: "writing-help" "Writing documentation"
|
||||
"By convention, documentation is written in files with the " { $snippet ".facts" } " filename extension."
|
||||
$terpri
|
||||
"A pair of parsing words are used to define free-standing articles and to associate documentation with words:"
|
||||
{ $subsection POSTPONE: ARTICLE: }
|
||||
{ $subsection POSTPONE: HELP: }
|
||||
|
|
|
@ -212,6 +212,7 @@ vectors words ;
|
|||
"/library/threads.facts"
|
||||
"/library/words.facts"
|
||||
"/library/bootstrap/image.facts"
|
||||
"/library/bootstrap/init.facts"
|
||||
"/library/collections/growable.facts"
|
||||
"/library/collections/arrays.facts"
|
||||
"/library/collections/graphs.facts"
|
||||
|
|
|
@ -5,7 +5,6 @@ USING: assembler errors io io-internals kernel math namespaces
|
|||
parser threads words ;
|
||||
|
||||
: boot ( -- )
|
||||
#! Initialize an interpreter with the basic services.
|
||||
init-namespaces
|
||||
cell \ cell set
|
||||
millis init-random
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
IN: kernel-internals
|
||||
USING: help kernel ;
|
||||
|
||||
HELP: boot "( -- )"
|
||||
{ $description "Called on startup as part of the boot quotation (see " { $link set-boot } ") to initialize the runtime and get ready to run user code." } ;
|
Loading…
Reference in New Issue