As part of the programming assignments of our compilers related class. I've proposed to my teacher to use ANTLR instead of flex bison and here he ask me to ensure that it does all what we want, i.e lexical, syntactical and semantic analysis (thre first three steps in the image below) which I'm pretty sure that it's very easy to build such analyzer using ANTLR. but also the intermediate and object code generation phase of compilers (rest of the phases in the image below) and this is really confusing me. I've expected that such tool have to give users facilities to do such generations but I didn't find anything that explains how to do that even in the reference book written by the author.
Can anyone here explain to me how to do so or just point me to the write material that can help me to convince my teacher.
The short answer is that ANTLR is well-suited for compiler implementation, and at least a functional equivalent of YACC/Bison for this purpose.
Specific to your question, ANTLR provides Lexer (lexical analysis), Parser (syntactic analysis), and tree-walker (semantic analysis) support, all with appropriate forms of error listener and recovery mechanisms. An example symbol table is in the github repo.
Multiple tree-walks are typically used in semantic analysis. A final walk can be used to output some intermediate representation (IR) of the code.
Look at the IR language, optimizers, and code generators provided by the LLVM project to understand what is involved in the remaining steps.
Prof. Parr's books Language Implementation Patterns and TDAR will help.