Add a file with my better idea in it

This commit is contained in:
Sasha Koshka 2024-02-14 10:22:08 -05:00
parent 6cd60cc9a6
commit 025302a959
1 changed files with 33 additions and 0 deletions

33
analyzer/modules-plan.md Normal file
View File

@ -0,0 +1,33 @@
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.