IN today’s industry work experience is not everything. Once you meet the basic requirements there is only one thing left standing between you and your job which is a “job interview”.Today I will explain a question that developers are always asked in interviews.
The compiler is a program that takes source code written in a high-level programming language as input and produces output in machine language according to the architecture of the machine. The machine code that is produced as output can be run again and again at any time with different inputs.
We can use the Java Compiler as an example that is called Javac. Javac converts the source file with the .java extension to a .class file written in Java bytecode, for the usage of the code in the Java Virtual Machine.
The compiler checks the code before compiling the source code. This is reported if there are any error situations that the compiler found. This allows us to fix any coding errors before we get a fully working program. However, the fact that a program has been compiled successfully does not necessarily mean that it is error-free and will do what is required. We need to test our program with various data and make sure it works logically as well.
If we have a C program compiled on a Linux operating system, we cannot copy this compiled program and wait for it to run on the Windows operating system. If we want to run our same C program on Windows, we will need to recompile the program using a C compiler on a Windows computer.
An Interpreter is a program that takes source code with the data for the program as input and executes the source program line by line.
An example is the Java interpreter java. Converts the Java .class extension file into natural machine codes that can be run on the machine on which it is running.
Compiler and interpreter work together in Java. That is, it is compiled first to produce a bytecode from the generated source code. This compiled bytecode is then interpreted and executed on the Java Virtual Machine (JVM). This comes with some advantages. The most important is platform independence. Our bytecodes will work smoothly on every machine running JVM. The second advantage is that since our Java bytecode runs on a virtual machine, we are protected by a security layer that protects against malicious programs.
Java bytecode and java interpreter are not only used in Java language. As an example, we can use Jython to compile from Python language to Java bytecode and then use java to interpret. Also, compilers ML, Lisp, and Fortran compile it into java bytecode.
We can classify programming languages as follows…
I clarified some of the terms you’ll see in the programming languages.
Hopefully, this overview has helped you better understand the terminology that is used for classifying programming languages.
If you found this helpful please share it on your favorite social media so other people can find it, too.
If that’s interesting for you, read and follow me on Medium.