]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/tree/builder/builder-docs.factor
Docs: stub docs for some compiler-related words
[factor.git] / basis / compiler / tree / builder / builder-docs.factor
index 83093470c9e0168731429b3f789938718186dc5a..5f761be68153a4a66f1a1c6ffff45079bfee03b4 100644 (file)
@@ -1,5 +1,5 @@
-USING: help.markup help.syntax sequences quotations words 
-compiler.tree stack-checker.errors ;
+USING: compiler.tree help.markup help.syntax literals quotations sequences
+stack-checker.errors words ;
 IN: compiler.tree.builder
 
 HELP: build-tree
@@ -10,4 +10,20 @@ HELP: build-tree
 
 HELP: build-sub-tree
 { $values { "in-d" "a sequence of values" } { "out-d" "a sequence of values" } { "word/quot" { $or word quotation } } { "nodes/f" { $maybe "a sequence of nodes" } } }
-{ $description "Attempts to construct tree SSA IR from a quotation, starting with an initial data stack of values from the call site. Outputs " { $link f } " if stack effect inference fails." } ;
+{ $description "Attempts to construct tree SSA IR from a quotation, starting with an initial data stack of values from the call site. Outputs " { $link f } " if stack effect inference fails." }
+{ $examples
+  { $unchecked-example
+    ! The out-d numbers are unpredicable.
+    "USING: compiler.tree.builder math prettyprint ;"
+    "{ \"x\" } { \"y\" } [ 4 * ] build-sub-tree ."
+    $[
+        {
+            "V{"
+            "    T{ #push { literal 4 } { out-d { 1 } } }"
+            "    T{ #call { word * } { in-d V{ \"x\" 1 } } { out-d { 2 } } }"
+            "    T{ #copy { in-d V{ 2 } } { out-d { \"y\" } } }"
+            "}"
+        } "\n" join
+    ]
+  }
+} ;