Translator (computing)

From Wikipedia, the free encyclopedia

A translator or programming language processor is a computer program that converts the programming instructions written in human convenient form into machine language codes that the computers understand and process. It is a generic term that can refer to a compiler, assembler, or interpreter—anything that converts code from one computer language into another.[1][2] These include translations between high-level and human-readable computer languages such as C++ and Java, intermediate-level languages such as Java bytecode, low-level languages such as the assembly language and machine code, and between similar levels of language on different computing platforms, as well as from any of these to any other of these.[1] Software and hardware represent different levels of abstraction in computing. Software is typically written in high-level programming languages, which are easier for humans to understand and manipulate, while hardware implementations involve low-level descriptions of physical components and their interconnections. Translator computing facilitates the conversion between these abstraction levels.[3] Overall, translator computing plays a crucial role in bridging the gap between software and hardware implementations, enabling developers to leverage the strengths of each platform and optimize performance, power efficiency, and other metrics according to the specific requirements of the application.[4]

Programming Language Processors[edit]

The software development process is noticeably different depending on the type of translator used by a developer. Stages of the development process that are influenced by a translator include the initial programming stage, the debugging stage, and most notably the execution process. Factors that are affected during these stages include code performance, feedback speed for the debugging process, language features, and platform independence. Some of the more notable programming language processors used to translate code are compilers, interpreters, and assemblers.[5]

Compilers[edit]

Compiler software interacts with source code by converting it typically from a higher-level programming language into object code that can later be executed by the computer's Central Processing Unit (CPU).[6] The object code created by the compiler consists of machine-readable code that the computer can process. This stage of the computing process is known as compilation. Utilizing a compiler leads to separation in the translation and execution process. After compilation, the new object code is saved separately from the source code resulting in the source code no longer being required for the execution process. With compiler programs, the translation process occurs one-time which results in efficient code that can be executed quickly for any number of times.[6]

There are clear benefits when translating high-level code with a compiler.[7]

  • Compilation leads to faster run time when executing the program. Since code is translated before execution, its results are optimized and fast.
  • Compilers are more ideal when protecting code from plagiarism and preventing the use of source code from an unauthorized party.
  • Object code only needs to be created once when compiling source code.

There are clear disadvantages when translating high-level code with a compiler.[7]

This image represents the translation process through a compiler.
  • Object code produced during compilation is specific to a machine's instruction set architecture (ISA). This results in object code that is dependent on a specific type of machine in order to run.
  • The debugging stage of the development process cannot start until the program is fully compiled. Errors are only viewable after compilation.
  • Any source code that is modified must be fully recompiled to be executed again.

Some notable programming languages that utilize compilers include:[8]

Interpreters[edit]

Interpreter programs function by interpreting high-level code into machine useable code while simultaneously executing the instructions line by line. Unlike compilers, interpreters do not need to compile the code prior to executing the instructions. The translation and execution process are done simultaneously and is interrupted in the event of an error in the program. The use of an interpreter allows developers to test and modify code in real-time. It makes the debugging process easier as well as aids in making more efficient code. Since the translation and execution process is done simultaneously, the execution time for interpreter programs is substantial.[5]

There are clear benefits when translating high-level code with an interpreter.

  • Since object code is not created in the interpretation process, less memory is required for the code.[5]
  • Interpreter languages do not create machine-specific code and can be executed on any type of machine.[7]
  • The development and debugging process is typically quicker due to less complexity and it has more flexibility.[7]

There are clear disadvantages when translating high-level code with an interpreter.[7]

  • Programs require that an interpreter is installed on the machine in order to run and interpret it.
  • The execution time of the program is slower than a compiler.

Some notable programming languages that utilize interpreters include:[5]

Assemblers[edit]

An assembler program functions by converting low-level assembly code into a conventional machine code that is readable by the CPU. The purpose of assembly language, like other coding languages, is to make the programming process more user-friendly than programming in machine language. Assembler languages utilize mnemonic devices and symbolic addresses to differentiate between opcode, operands, and specific memory addresses. Many of these components are not easily readable by humans and therefore mnemonics, symbols, and labels make the code decipherable. The assembler works by processing code one line at a time and then moves on to the next instruction. To eliminate issues that occur due to addressing locations, the translation process known as assembly is typically done in a two-pass process. The first pass of assembly is done in order to identify binary addresses that correspond to the symbolic names. This is essential in order to guide pass two which is the line-by-line translation into machine language.[9]

There are many commonly used assemblers in the world of computing that conduct the translation process. The type of assembler used by a developer is correlated to the specific processor architectures of the computer.[10]

Commonly used assemblers include:



See also[edit]

References[edit]

  1. ^ a b Thornton, Scott (2017-02-17). "What are compilers, translators, interpreters, and assemblers?". MicrocontrollerTips. Archived from the original on 2019-07-19. Retrieved 2020-02-02.
  2. ^ "Translators And Utilities For Program Development". Software Handbook (PDF). Intel Corporation. 1984 [1983]. p. 3-1. 230786-001. Archived (PDF) from the original on 2020-01-29. Retrieved 2020-01-29.
  3. ^ Beaulieu, Adrien (2022). "A15. Front-End and Back-End Technologies: The Importance of Proficiency in Multiple Programming Languages".
  4. ^ Pagadala, Santosh Kumar (2004). "Portable implementation of computer aided design environment for composite structures".
  5. ^ a b c d "Language Processors: Assembler, Compiler and Interpreter". GeeksforGeeks. 2018-08-09. Retrieved 2024-03-15.
  6. ^ a b "CSE 5317/4305: Design and Construction of Compilers". lambda.uta.edu. Retrieved 2024-03-15.
  7. ^ a b c d e "Translator Types". Ada Computer Science. 2024-03-15. Retrieved 2024-03-15.
  8. ^ "Compiled versus interpreted languages". www.ibm.com. Retrieved 2024-03-15.
  9. ^ a b Patt, Yale; Patel, Sanjay (2019-08-15). Introduction to computing systems: From bits & gates to C/C++ & Beyond (3rd ed.). New York, NY: McGraw-Hill. pp. 231–243. ISBN 978-1260150537.
  10. ^ a b c d e "What are some Popular Assembly Languages? | Lenovo US". www.lenovo.com. Retrieved 2024-03-15.

Further reading[edit]