> 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 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 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.
What is actually expected as output? Parser generators generate source code. Compilation is done as an extra step which does not involve the parser generator. So, what is the "intermediate and object code" you want actually? Flex/Bison work in the same way.
And yes, you can of course create the necessary tools for lexical and syntactic analysis. Semantic analysis is a bit different. That's not a parser's task (it is by nature made to do syntactic checks). Semantic steps are usually an isolated task (e.g. walk a generated parse tree to fill a symbol table). This step is independent of the parser generator or the generated parser code.
Mike
--
www.soft-gems.net