Compilers: Backend to Frontend and Back to Front Again
Author :
Abdulaziz Ghuloum,
Computer Science Department,
Indiana University
Publication Date : September 2006
Book Excerpts:
Compilers are percieved to be magical artifacts, carefully crafted by the wizards, and unfathomable by the mere mortals. This document attempts to dispel this myth. We build a simple compiler for a simple language in a step-by-step fashion. The input language accepted by the compiler starts minimal, and grows as reader's knowledge of how to build compilers grows. The final language is almost Scheme.
Although the compiler is written in the
Scheme programming language, only minimal knowledge of Scheme is required. Essentially, the reader is assumed to be comfortable reading and writing recursive Scheme functions to the level presented in
The Little Schemer. Additionally, people familiar with other programming languages but not Scheme are recommended to read the freely available tutorial
Teach Yourself Scheme in Fixnum Days.
The Scheme Programming Language is an invaluable resource for understanding Scheme’s semantics. Readers will find it most useful when they give up in thinking how
list? detects circular data structures.
Our compiler targets the Intel-386 architecture, the dominant architecture for personal computing. The output of our compiler is assembly code that can be assembled by
gas, the GNU assembler, which is freely available for most operating systems. No knowledge of assembly language or the Intel-386 architecture is assumed beyond the basics: binary numbers, memory layout, and basic pointers. Readers who're familiar with arrays in C, and know how the bit-level operations (
and,
or,
xor, and
not) work, are good to go.
View/Download Compilers: Backend to Frontend and Back to Front Again |
Tests