I'd like to build my own compiler for tiny C language: I've already make my grammar, build an AST (abstract syntax tree) using ANTLR, and implement my symbol table (following GRosemberg code)
I have to fill my symbol table with my symbols, but I don't really know how..
- Do I have to run through y AST and depending on which token I find I put an new symbol in my symbol table or create a new Scope...?
- Do I have to use semantic functions in my grammar, I've heard of a tree Walker...?
I'm a little bit lost for this step, is anyone has an example, or can tell me how to do please?