Compilers are pretty darned complex things, but we can talk about a few of the steps they go through. Among the first is a syntax check. The compiler makes sure you have used valid characters, keywords, variable names, punctuation and so on. If you're like me you've gotten a variety of compiler errors at this point like unmatched parens or missing semi-colons.
Then it builds an internal model of the program. I think JavaC builds an Abstract Sytax Tree that represents classes, methods, statements and so on down to the leaf operands of every clause. Now the compiler might find errors like casting or numeric truncation.
You mentioned linkage in the topic, but Java doesn't have an explicit LINK step like C or the mainframe COBOL I used to know. The compiler looks for references to other classes or interfaces and makes sure it can find them in other class files, jars, or wherever. In this phase you'll get errors like class not found or a method signature that doesn't match.
At run time the JVM looks for them all over again and may or may not find exactly the same ones the compiler found, which also leads to interesting error messages.
One could generate byte code right from the model, I think. Modern compilers examine the tree and/or the byte code and look for chances to optimize. This is pretty deep voodoo that I don't pretend to know but it often involves removing instructions that don't have any effect or maybe moving code around to eliminate calls or loops.
Any of that help? [ October 26, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi