I am writing a basic compiler that compiles a language down into custom bytecode instructions. The language allows for variable shadowing (this is a cause of one of the main problems I am running into). During Semantic Analysis the scopes of the symbol table are being pushed/popped and because variables can belong to different scopes, it is not hard to differentiate shadowed variables. The AST nodes store type and name as strings, so after Semantic Analysis how would the code generator be able to know which variable it needs to access if there are multiple variables with the same name?
Is it common to simply store the symbols on the AST instead, so that after semantic analysis there wouldn't be a need for the symbol table at all because all of its contents are directly connected to associated AST nodes?