I need to document the logic, because it's becoming a mess!
^ essentially this diagram shows that:
code1 and code2 are two libraries
after code1 is type-checked, the state of the type checker is passed (by reference) to type check code2
the same happens to type check code3: the type checker state of both code1 and code2 is passed (by reference)
note that the type checker state does not contain the full AST of the libraries anymore, just a summary (bunch of hashmaps)
code3 is different because it contains a main function.
The resulting type checker state of code3 is passed to the circuit writer.
The circuit writer will store all the type checker states (of all the libs and the main module)
This data will carry on to the witness generator. The witness generator needs it in case some of the inputs to the main function are custom structs from an external lib
TODO:
[ ] make sure that libraries cannot contain main functions
[ ] perhaps we should prune what the witness generator gets: it only cares about the custom structs (and only the ones that are present in the main function args). But also, maybe this is premature optimization and we never know what we might need in the future. Better store everything for now :D
I need to document the logic, because it's becoming a mess!
^ essentially this diagram shows that:
code1
andcode2
are two librariescode1
is type-checked, the state of the type checker is passed (by reference) to type checkcode2
code3
: the type checker state of bothcode1
andcode2
is passed (by reference)code3
is different because it contains amain
function.code3
is passed to the circuit writer.TODO:
main
functions