1 USING: compiler.tree help.markup help.syntax literals quotations sequences
2 stack-checker.errors words ;
3 IN: compiler.tree.builder
6 { $values { "word/quot" { $or word quotation } } { "nodes" "a sequence of nodes" } }
7 { $description "Attempts to construct tree SSA IR from a quotation." }
8 { $notes "This is the first stage of the compiler." }
9 { $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
12 { $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" } } }
13 { $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." }
16 ! The out-d numbers are unpredicable.
17 "USING: compiler.tree.builder math prettyprint ;"
18 "{ \"x\" } { \"y\" } [ 4 * ] build-sub-tree ."
22 " T{ #push { literal 4 } { out-d { 1 } } }"
23 " T{ #call { word * } { in-d V{ \"x\" 1 } } { out-d { 2 } } }"
24 " T{ #copy { in-d V{ 2 } } { out-d { \"y\" } } }"