|
|
 | | From: | malinda | | Subject: | Wonder about design of a Java compiler | | Date: | 29 Dec 2004 01:47:26 -0500 |
|
|
 | I Need Some Information About The Mechanisam Of The Java Compiler 1. Up To Where The Java Compiler Creates The Byte Code. The Steps The Java Compiler Take To Do So
( Not The Whole Compilation Process )
What I Need Is Upto Where The Compiler Translate The Programme(Source Code Into Byte Code (.Class File) )
So If Any Boddy Knows About This Please Send Me Info,Tutorials,Webaddresses About This To My E-Mail Address Malinda.Fernando@Gmail.Com
Thanx [Um, once you've generated the byte codes, you're done. -John]
|
|
 | | From: | sgganesh at gmail.com | | Subject: | Re: Wonder about design of a Java compiler | | Date: | 3 Jan 2005 00:53:51 -0500 |
|
|
 | Writing a Java compiler is not a very difficult: Java is a considerably simple language (compared to, say, C++), and can be written following traditional compilation techniques.
In past, I've written a Java compiler when I was a college grad, to expriment compiler implementation techniques I learned in our college course: it took around 6 months to write a reasonably robust implementation. The conventional lex->syntax->semantics->code-gen was followed. You would need to refer the books The Java Language Specification and The Java Virtual Machine Specification by the original designers of Java from Sun.
Two main differences I noticed from conventional compilers and Java compilers:
The native code generation techniques (like register allocation) are not useful in Java (but for a VM, and the file format is .class file, with bytecodes; bytecode level is something like a (stack-based) intermediate language you would use in a traditional compiler implementation from which you would proceed to generate native code; in Java compiler, you stop there).
Traditional, simple optimizations (like constant folding) can be done in the compiler, but sophisticated optimizations cannot be done in Java because of the restrictions imposed by the .class file format and its close interaction/depenency with JVM.
-Ganesh
|
|
 | | From: | VBDis | | Subject: | Re: Wonder about design of a Java compiler | | Date: | 30 Dec 2004 01:01:31 -0500 |
|
|
 | "malinda" schreibt:
>What I Need Is Upto Where The Compiler Translate The Programme(Source >Code Into Byte Code (.Class File) )
You mean a description of the structure of an .class file? AFAIR such a description comes together with the Sun documentation of the VM and bytecode itself.
DoDi
|
|
|