2014-04-24 15:35:04 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								USING:  compiler.tree  help.markup  help.syntax  literals  quotations  sequences 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								stack-checker.errors words ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-24 00:50:21 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								IN:  compiler.tree.builder 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-20 05:24:37 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-24 00:50:21 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  build-tree 
							 
						 
					
						
							
								
									
										
										
										
											2009-04-22 13:26:28 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "word/quot"  { $or word quotation } } { "nodes"  "a sequence of nodes"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-07-24 00:50:21 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Attempts to construct tree SSA IR from a quotation."  }
							 
						 
					
						
							
								
									
										
										
										
											2008-07-20 05:24:37 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $notes "This is the first stage of the compiler."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $errors "Throws an "  { $link inference-error } " if stack effect inference fails."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-04-22 00:02:00 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								HELP:  build-sub-tree 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-11 15:07:33 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $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"  } } }
							 
						 
					
						
							
								
									
										
										
										
											2014-04-24 15:35:04 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $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
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;