Support lazy referencing

this PR would make the snowcrash able to recognize references which has been defined after the location of the usage. closes issue #84.
Just break the nested for cycles into separate functions. That will greatly improve the readability of the code. Thank you.