Hi all ive been thinking of a writing a compiler in java for my final year project. I have started to browse the net for help but to be honest its confused rather than helping me to get a clear image of what I would like to do.

E.g. I have read that a compiler is something which transforms source code (Java) into another computer language. To my knowledge that is a cross compiler? I always thought a compiler is what translates a source code (Java) into machine code. So many website say different things. Also I haven’t really had a module on compiler design so im a blank slate at the moment.

So I was just wondering anyone has written there own compiler in Java what the necessary steps and maby where should I start. I would be very grateful if you could recommend some good reading material

Thanks in advance.

A compiler transforms code into something that can be executed by something else.
Thus a Java compiler will take Java sourcecode and transform it into classfiles for execution by a Java Virtual Machine.
A crosscompiler is a special case of a compiler that compiles sourcecode into executable code for another platform, allowing you to for example compile Mac executable code under Windows.

What you're describing as finding transforms Java sourcecode into sourcecode in some other language. That's neither a compiler nor a cross compiler, it's a transpiler.
Of course if a runtime environment takes source code as its input and executes it a transpiler could be a compiler as well. A transpiler that produces Python or Ruby sourcecode would be an example of this.

Many people have written compilers in Java that produce Java bytecode for a variety of programming languages.

Hey thanks for the replies and thanks for clearing that up jwenting. ive just started to read that book dleskov hopefully its good. if anyone else has made a compiler in java could you comment on your experience.