RAGS generates SQL statements by walking a stochastic parse tree and printing it out. ... RAGS ... builds the tree stochastically as it walks it. RAGS follows the semantic rules of SQL by carrying state information and directives on its walk down the tree and the results of stochastic outcomes as it walks up. For example, the datatype of an expression is carried down an expression tree and the name of a column reference that comprises an entire expression is carried up the tree. RAGS makes all its stochastic decisions at the last possible moment.
Google-1
Google-2
By permission of the Very Large Database Endowment