How to convert a programming language into machine code

First, this article is written by a Japanese man who is studying English now, so I think it may use incorrect English grammar and phrases. I would appreciate your kind understanding.

In this article, I introduce about how to convert a programming language into machine code. Let’s get down to the main topic.

Compilation and Interpretation

First, Programming languages such as Python and Java are considered high-level languages. They are designed to make programming easier for humans to understand.
In addition, I want to come to an understanding of the different kinds of programming languages. In programming languages, there are broadly two kinds. That’s compiled language and interpreter langage. Each features is the following.

Compiled languages

Code is translated into machine code once and then executed. Examples include C, C++, and Java. Processing flow in Java is the following.

Process flow in Java:
Java code → Compiler → Bytecode → JVM → Machine Code.

Interpreter langages

Code is executed directly by an interpreter, translating it on the fly. Examples include Python, JavaScript, and Ruby. Processing flow in Python is the following.

Process flow in Python:
Python code → Interpreter → Machine Code.

Why this translation is possible

Why this translation is possible? There are three elements.

  • Syntax and Semantics
  • Abstract Representation
  • Compiler/Interpreter Design

Syntax and Semantics

High-level programming languages make it easier for people to write and understand code. They are designed to simplify the process of programming by providing abstractions and tools that handle the complex details of computer operations. This makes them ideal for developing a wide range of applications efficiently.

Abstract Representation

High-level programming languages provide an operations of the logic and abstract representation that need to be performed. Compilers and Interpreter break down these abstract representations into basic instructions that the machine’s processor can understand.

Compiler/Interpreter Design

Compilers and Interpreters understand high-level programming language, analyze it, optimize it, and generate equivalent machine instructions. I explained a lot until now, but after all, it is the compiler or interpreter that translates high-level programming languages into machine language. By the way, machine language consists of binary code, which is the most basic form of code understood directly by the computer’s CPU. Each type of CPU has its own machine language.


Programming languages can be converted to machine language because they are designed to be translated into low-level language that a computer’s CPU can read. This conversion is managed by compilers and interpreters, which execute the process of translating high-level language into machine language.