I have read that yacc generates bottom up parser for LALR(1) grammars. I have a grammar for Java 1 that can be used for generating three address code and is strictly LALR(1), but the translation scheme I am employing makes it L-attributed. Now I have read that L-attributed LR grammars cannot be parsed by using bottom up parsing. So, can yacc be used here or not?
A grammar's parser serves to recognize the language generated. Tools like YACC augment the parser to (essentially) trace a parse tree (some automatically build an AST, abstract syntax tree) for the parsed string according to the grammar. You can then walk this structure to generate code. But that is a separate task, that commonly uses different tools.
I'm not sure if this is what you're asking, but you can't write a single-pass Java compiler.
In C or C++, you have to declare (possibly forward-declare) a function before you use it. In Java, you don't. Since you need to know the declaration of a function/method in order to type check the call site, it follows that you can't type check a Java compilation unit until you have finished parsing it.
(Of course, you may be able to type check the three-address code, depending on the specifics of your representation.)