Hello guys,
Thanks for your help before.
I am new in programming language, especially in Java. I am reading a java book and find a theory about Interpreter and Compiler. Could anyone explain different between them.
Thanks,
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hello guys,
Thanks for your help before.
I am new in programming language, especially in Java. I am reading a java book and find a theory about Interpreter and Compiler. Could anyone explain different between them.
Thanks,
Welcome to the forums!
A big part of learning how to program is research and self learning. The good news that the largest library ever created is a google search away. Why don't you do a bit of reading and come back with your own understanding of the difference between the two and then we will have a discussion about things you don't fully understand.
Computers are fascinating machines, but they're mostly a reflection of the people using them.
-- Jeff Atwood
Hello ChristopherLowe,
Thanks for your advice. I have red several articles about them. The main point is the interpreter execute and translate the high level language into machine language line by line and show up if there is an error, but compiler execute all of codes and running it, and also show up if there is an error.
one question from me,
When we use interpreter and compiler ? because both same translate codes to machine language.
Thanks,
Some languages are interpreted, some are compiled. You don't make the choice except by choosing which language to use.When we use interpreter and compiler ?
Sometimes there's an intermediate step. Java compiles to byte code which is interpreted by a JVM specific to the using computer's OS and processor.because both same translate codes to machine language.
okay, I see. It depend on language to use.
sip Greg Brannon, thanks for your explanation.
Just to be complete, there are occasional compilers for languages that are typically interpreted, but I don't believe they've been reliably maintained for any length of time.
Not quiet correct. A compiled language turns the source code into native machine code which can be directly executed by the hardware. An interpreted language compiles the source code into something that can be read by an interpreter and then converted into machine code.
For example, C is a compiled language. The gcc compiler converts .c files to executable binaries and as such you need to target the cpu architecture at compilation. Java on the other hand an interpreted language. The javac compiler turns .java file into bytecode called .class files. Then it's up to the Java runtime environment to interpret the bytecode and turn it into executable machine code on the fly.
The advantage of the Java interpreted paradigm is you can leave native hardware details up to the JRE, whereas is C you typically compile separately for each target platform with a bunch of IFDEF's to handle different system architectures. The disadvantage of interpreted languages is that the users need special software, such as the JRE to run the program. There is also an (arguably inconsequential) performance overhead with interpreted languages compared to compiled ones because there is the extra step of interpretation.
Computers are fascinating machines, but they're mostly a reflection of the people using them.
-- Jeff Atwood