Skip to main content
Library homepage
Engineering LibreTexts

1.4: Compiling

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The Compile Process

    The process then to take the preprocessed code and turn it into executable code is a bit more complex. Depending on who you are talking to the steps may be a called something a bit different - but the actual process is the same, we will take a brief look at the steps in the next several pages.

    • High Level Language – refers to a programming language such as C++, Java, C#, etc. They are typically much easier for humans to read an understand than low level languages like machine code and assembly language.
    • Pre-Processor – The pre-processor removes all the directives and performs: file inclusion, macro-processing, performs conditional compilation as previously discussed
    • Assembly Language – Its neither in binary form nor high level. It is an intermediate state that is a combination of machine instructions and some other useful data needed for execution.
    • Assembler – For every platform (Hardware + OS) we will have a assembler. They are not universal since for each platform we have one. The output of assembler is called object file. Its translates assembly language to machine code.
    • Relocatable Machine Code – It can be loaded at any point and can be run. The address within the program will be in such a way that it will cooperate for the program movement.
    • Loader/Linker – It converts the relocatable code into absolute code and tries to run the program resulting in a running program or an error message (or sometimes both can happen). Linker loads a variety of object files into a single file to make it executable. Then loader loads it in memory and executes it.
    • Absolute Machine Code - This is the executable file, based on the system architecture and operating system it is to run on.

    Adapted from: "Introduction of Compiler Design" by Rajesh Kr JhaGeeks for Geeks is licensed under CC BY-SA 4.0

    This page titled 1.4: Compiling is shared under a CC BY-SA license and was authored, remixed, and/or curated by Patrick McClanahan.

    • Was this article helpful?