Understanding Program Translation
Chamika Eshan
?? Freelance Software Engineer | ?? Information Technology Instructor | ?? ISO/IEC 27001:2022 Statement of Applicability Contributor | ?? Freelance Product Graphic Designer | ?? Academic Writer
Basically, Program Translation is divided into three categories.
Natively Compiled Languages
In natively compiled languages, the source code is directly compiled into machine code (native code) by a compiler. This machine code can run directly on the operating system and hardware without requiring any additional software.
Characteristics:
Advantages:
Disadvantages:
You bake cookies and deliver them directly to your friend’s house. The cookies are ready to eat and require no extra work. If your friend is allergic to gluten (platform incompatibility), you’ll have to bake a new batch from scratch.
Interpreted Languages
Interpreted languages execute the source code line by line at runtime using an interpreter (a software program that translates code into machine-readable instructions on the fly).
Characteristics:
领英推荐
Advantages:
Disadvantages:
You’re giving your friend cookie instructions over the phone (“Take 1 cup of flour, then add sugar…”) as they bake them step by step. If your friend is slow to follow instructions, it takes forever to finish.
Hybrid Approach
In a hybrid approach, the source code is first compiled into an intermediate representation (like bytecode) instead of native machine code. This intermediate code is then executed by a virtual machine (VM) or interpreter. Some implementations use Just-In-Time (JIT) compilation, where bytecode is further converted into native machine code at runtime.
Examples:
Advantages:
Disadvantages:
You pre-bake the cookies halfway (bytecode) and freeze them. Your friend puts them in the oven to finish baking when they want to eat. It’s faster than interpreted, but still not as fast as delivering fully baked cookies.