summaryrefslogtreecommitdiff
path: root/src/scope.c
AgeCommit message (Collapse)Author
2023-04-29scope: Add a scope stack for identifier resolutionsCarlos Maniero
Before accepting an identifier, the parser should check if that identifier will be available. With this implementation it will be possible. Take the following code example: main(): i32 { return my_exit_code; } The parser must return an error informing that *my_exit_code* is not defined in the example above. The ast scope is a support module for parser and ast, simplifying identifier resolution. Once a curly bracket ({) is open the *scope_enter()* is called and when it is closed (}) we pop the entire stack with *scope_leave()*. Signed-off-by: Carlos Maniero <carlosmaniero@gmail.com>