Ordering of files alg. is splitted into 3 parts:
- Collecting symbols from AST
- From symbols, find dependencies between files
- Construct oriented graph from dependencies and solve topological order on it
For each file, from untyped tree we collect three types of symbols:
- symbol definition, fully qualified (let bindings, type declaration, DU case constructors, record fields, members)