Compiler

Compiler

July 2, 2023 | permanent

Summary #

tags :

ref

Source code #

Input to a compiler or other code translator. Source code is normally generated by humans (and thus hopefully able to be read and modified by humans) and is the human-readable representation from which all the other forms of code are created.

Object code #

Object code is code generated by a compiler or other translator, consisting of machine code, byte code, or possibly both, combined with additional metadata that will enable a linker, loader, or linker-loader to assemble it with other object code modules into executable machine code or byte code.

Assembly code #

is plain-text and (somewhat) human read-able source code that mostly has a direct 1:1 analog with machine instructions. i.e. a low-level programming language code that requires software called an assembler to convert it into machine code. hence it has strong correspondence between the program’s statements and the architecture’s machine code instructions. It consists of a set of English like standard instructions.

Byte code #

Byte code (in Java, Python and etc.) is an intermediate code between source code and machine code that is executed by an interpreter such as JVM. e.g., Java class file. This makes byte code portable across multiple platforms (a combination of hardware and operating system) as long as a virtual machine is implemented on that platform. Instruction in an intermediate form which can be executed by an interpreter such as JVM. e.g., Java class file

Machine code #

Machine code(Native Code) is binary (1’s and 0’s) code that can be directly executable by the computer’s physical processor without further translation.

image ref

Binary code #

Simply: Binary Code is the name of expressing 1’s and 0’s. Nibbles and Bytes and Words are the starting points here… or just 111010101101010110101101100001110101110..nibble 1011, byte 10111010.. etc.

is an instruction set for a computer, CPU. It uses Binary Code to show how it’s organized.

Quora

Encoding #

Binary encoding is a technique used to represent data or information using a binary system, which consists of only two symbols: 0 and 1. It is a fundamental method in computer science and digital electronics for storing and processing data.

Executable file #

The product of the linking process. They are machine code which can be directly executed by the CPU. e.g., a .exe file.

Library file #

Some code is compiled into this form for different reasons such as re-usability and later used by executable files.

Compilation and CPU #

When you compile, you usually specify a target CPU; if you don’t, the compiler will use your current CPU and limit itself to only selecting instructions that are common to your CPU and older versions of it. If you want to use a fancy new instruction that is only available on a specific revision of your target CPU, you can either tell the compiler or manually code it using intrinsic or inline assembly code. However, if you run your program on a CPU that does not support that instruction, it will crash. ref

Compiling from source code vs pre-built package? #

ref