A compiler is a program that takes a programming language like that of java and then translates it into computer language for the software user. The interpreter just ( just like that of a human interpreter) takes the foreign language which would be that of the programming language and turns it into the machine code. Both of these programs take a high-level programming language and translates them into the machine code, but the interpreter is slower to translate than the compiler because of the fact it processes and interprets each statement many times.
According to me compiler is better as it reads the whole program at one go and shows all the errors simultaneously (whereas interpreter reads one line at a time and shows the error one by one if any)..
-Shruti Jainbecause the compiler convert whole of the sentence once into the machine langauge but the interpreter convert one by one
in my personal point of view i would say a parser is more like "one-directional" "automatic" vs. an interpreter, the interpreter has more "intelligence"
a compiler translates an entire program and then executes it while an interpreter translates and executes one line of a program at time
Due to platform independence, a Java compiler will interpret Java source code into Java Byte Code and pass to the JVM, which will pass machine understandable code through to cpu. (clarification needed).A conventional compiler converts source code directly to machine code.(clarification needed).
Hybrid compiler is a compiler which translates a human readable source code to an intermediate byte code for later interpretation. So these languages do have both features of a compiler and an interpreter. These types of compilers are commonly known as Just In-time Compilers (JIT). Java is one good example for these types of compilers.
because the compiler convert whole of the sentence once into the machine langauge but the interpreter convert one by one
in my personal point of view i would say a parser is more like "one-directional" "automatic" vs. an interpreter, the interpreter has more "intelligence"
You will have to ask the compiler and interpreter writers that question. What I can tell you with certainty, at one time all programs were hand assembled.
I think the question is wrong. It should be compiler vs interpreter. compiler reads the progem in c/c++ convert it to machine code (object code) and then loader loads it in the memory to run in the supervision of OS. Interpreter reads one line of the code executes it and then reads the next and runs and so on. compiler only creates executables, it doesn't run them while interpreter runs them.
Neither one will be categorically "better" than the other. In general, compilers produce more efficient programs, while interpreters produce more reusable code (platform independence).
a compiler translates an entire program and then executes it while an interpreter translates and executes one line of a program at time
The key differences between a compiler and an interpreter are: Translation Process: Compiler: Translates the entire program into machine code (or intermediate code) at once before execution. Interpreter: Translates and executes the program line-by-line at runtime. Execution Speed: Compiler: Generally results in faster execution since the entire program is precompiled. Interpreter: Tends to be slower, as it translates code during execution. Output: Compiler: Produces an independent executable file after compilation. Interpreter: Does not produce a separate file; it directly executes the code. Error Handling: Compiler: Detects all errors at once during compilation. Interpreter: Stops execution when it encounters an error, making it easier to debug, but only reports errors line by line. Examples: Compiler: C, C++, Java. Interpreter: Python, JavaScript, Ruby.
Due to platform independence, a Java compiler will interpret Java source code into Java Byte Code and pass to the JVM, which will pass machine understandable code through to cpu. (clarification needed).A conventional compiler converts source code directly to machine code.(clarification needed).
Hybrid compiler is a compiler which translates a human readable source code to an intermediate byte code for later interpretation. So these languages do have both features of a compiler and an interpreter. These types of compilers are commonly known as Just In-time Compilers (JIT). Java is one good example for these types of compilers.
A compiler isn't technically part of the computer. A compiler takes the source code of a program and compiles it into a usable program. However, without a compiler, there will be very few programs, and thus computers won't be much use.
Basically they do the same: converting from one level of language into another. A compiler converts high level language (programming language like java) into machine-language. That is language a computer understands. An interpreter converts high level language into an intermediate level. When a program is exectuted, that intermediate level is reconverted to machine language.
Not really. You need some program to interpret your source code. There is the "assembler", but that can be thought of as a simpler version of a compiler - simpler, because the assembler basically just converts the source code instructions one-to-one to machine instructions.