What is the best way to make semantic analysis ?

Jul 9, 2013 at 1:19 PM
I want to make some semantic analysis on AST nodes like symbols table verification and type checking.
How can i do it ?
Ideally this step should be included at the end of the parsing process to produce additional error messages.
Jul 9, 2013 at 7:55 PM
Hello Malain,

When your AST is constructed, you can apply tree-walking algorithms to do semantic checks. For the task you described, single pass of a DFS-visitor should suffice.
Sep 7, 2013 at 3:37 PM
Thanks Eugene,

I have implemented a SemanticAnalysisVisitor called in BuildAst because i can use the parseTree.ParserMessages to generate messages.
That works fine.