Layout updates.
Handle comments at the end of the file when pretty-printing.
Remove some debug.
Handle different repository layouts.
Handle reading of DERIVE attributes.
Fix TYPEOF and USEDIN.
Fix QUERY evaluation and other small changes.
Fix calling of defined functions and add support for builtin ones.