1.1 KiB
note to self clean this up afterward and move it into design/modules because this realllllly sucks.
semantic tree: index top-level declarations by a key:
Key struct { UUID Name }
Tree.Analyze should take in: ⁃ UUID ⁃ Syntax tree
only analyze one unit at a time.
parser should have no idea about what a unit is, and UUID fields in top level declarations are to be considered semantic.
important: in order for the compiler to make sure everything is analyzed, it does this
module: take in semantic tree, address, skimming book as parameters parse metadata file if currently parsing a unit with this uuid, error push this units uuid onto a stack for each dependency unit, recurse, passing in semantic tree and true to skimming parse unit files into one syntax tree. if skimming, do a skim parse analyze syntax tree into semantic tree pop this units uuid off of the stack
have a simpler version for source files
this routine analyzes leaf units (no dependencies) first, which makes them available in the semantic tree for their dependents to depend on. this travels upward the root is reached.