JacquelineCasey / Nom

0 stars 0 forks source link

Better Scope Analysis #5

Open JacquelineCasey opened 1 year ago

JacquelineCasey commented 1 year ago

Currently, scopes are "leaky", meaning a variable defined inside one block can be used outside of that block. This will become particularly problematic after we add if statements.

Make it so that variables are checked to see if they follow scope rules. Emit errors if a variable disobeys scope rules.

Ideally we could prepare for adding support to the global scope, or just add it directly. Then, compilation can error early in the case of a misnamed function.

JacquelineCasey commented 1 year ago

While at it, consider adding the visitor pattern for ASTs.