diff --git a/doc/handbook/cookbook.facts b/doc/handbook/cookbook.facts index e82a275ad5..24b5fceb00 100644 --- a/doc/handbook/cookbook.facts +++ b/doc/handbook/cookbook.facts @@ -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 diff --git a/doc/handbook/handbook.facts b/doc/handbook/handbook.facts index 203b389c41..16b371a1f4 100644 --- a/doc/handbook/handbook.facts +++ b/doc/handbook/handbook.facts @@ -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" } diff --git a/doc/handbook/help.facts b/doc/handbook/help.facts index 513081267d..921c051316 100644 --- a/doc/handbook/help.facts +++ b/doc/handbook/help.facts @@ -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: } diff --git a/library/bootstrap/boot-stage1.factor b/library/bootstrap/boot-stage1.factor index 7461a859bc..22909e9316 100644 --- a/library/bootstrap/boot-stage1.factor +++ b/library/bootstrap/boot-stage1.factor @@ -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" diff --git a/library/bootstrap/init.factor b/library/bootstrap/init.factor index 858a3778b5..da37410294 100644 --- a/library/bootstrap/init.factor +++ b/library/bootstrap/init.factor @@ -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 diff --git a/library/bootstrap/init.facts b/library/bootstrap/init.facts new file mode 100644 index 0000000000..a83ead0098 --- /dev/null +++ b/library/bootstrap/init.facts @@ -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." } ;