CompilerDev/Bare Bones Compiler

From OSDev Wiki
Jump to: navigation, search

This page is under construction! This page is a work in progress and may thus be incomplete. Its content may be changed in the near future.

Difficulty level
Difficulty 2.png

Compilers are a very important piece of software in any Operating System Developer's toolkit. Without it, your code would only be code. You would have to write all executables by hand, or in assembly, and then assemble it. Compilers make this easy by allowing us to use a higher level language, such as C, C++, or D, in traditionally lower level programming. For example, Operating System development (such as the first builds of unix and apple DOS) used to have to be written in Assembly, which isn't neccesarily very portable, but with the creation of languages such as C, you are able to program in higher level, human-readable code that can be ported to any operating system that has a c compiler for it. Today, we are going to learn how to write a dsl in the C programming language.

Disclaimer: I am no where near an expert on the matter. This is not for people looking for advanced compiler lessons. This is for people who don't know anything about writing a compiler. Also, the code shown here might not necessarily be the best written, but the theories are tight.

Required Knowledge:

  • Knowledge of the C programming language and its standard library
  • Basic Algorithim Design
  • Ability to read a theory and implement it in code (if you have trouble with this, try practicing on a few algorithms of varying difficulty)
  • Knowledge of the ELF file structure
  • Knowledge of the Unix Operating System

What This Tutorial Covers

What This Tutorial Doesn't Cover

Personal tools