Warnings
Warnings - do we want them?
Use cases
-
unused variable - flag in symbol table if var is never referenced
- then traverse st after buildup to collect warnings
-
function never called - add a flag to symbol table (but exclude recursion)
-
use of an unassigned variable - simply add flag to symbol table
-
dead/unreachable code (@csav4759 [Johannes] , @c7031327 [Johannes]) - any statements after point of return?
Potential implementation
As the warnings are only thrown by the semantic checks, there is no need to adjust the lexer/parser. The semantic checks could simply return a list of warnings in addition to the result of the semantic checks.