Skip to content

Commit a3b552b

Browse files
Initial version of the site
1 parent b3f6f31 commit a3b552b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+17854
-11
lines changed

_sources/compiler-books.rst.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Compiler Books
2+
==============
3+
4+
I own a bunch of compiler books that I have purchased over the years.

_sources/index.rst.txt

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
================================
2+
Welcome to Compiler Programming!
3+
================================
4+
5+
This site aims to bring together practical knowledge regarding the design and implementation of optimizing compilers
6+
and interpreters for Programming Languages.
7+
8+
There are a number of books on Compilers and Interpreters however only a very few of them are accompanied by
9+
source code that implements the topics covered by the book. See below for a list of useful
10+
learning projects that do include source code.
11+
12+
In recent years, thanks to LLVM, new programming language design has become a fertile space. New Language implementations
13+
tend to focus on the language front-end, leveraging LLVM as the back-end for code optimization and code generation.
14+
While this is beneficial if you only care about the language design aspects, it is unhelpful for the industry
15+
as a whole, because the back-end of an optimizing compiler is a very interesting component, with a rich history of
16+
algorithms and data structures, and is a subject worthy of study on its own.
17+
18+
We will cover both front-end and back-end techniques. We will implement a small scale language as a way
19+
to learn various techniques, see what the common challenges are and how to address them.
20+
Language design not being our goal, we will keep the language as simple as possible so that it allows us to
21+
focus on important implementation issues.
22+
23+
Initially we will start with a procedural language. Later we will add features such as closures from functional languages
24+
and classes and objects from OOP languages. We will also look at advanced front end techniques such as type inference and
25+
generics.
26+
27+
The language will be statically typed to start with because this allows us to investigate the traditional compiler
28+
optimization pipeline. Dyamically typed languages have their own interesting engineering problems.
29+
We will eventually look at gradual typing and dynamic typing.
30+
31+
Preliminaries
32+
=============
33+
34+
.. toctree::
35+
:maxdepth: 2
36+
:caption: Preliminaries
37+
38+
prelim-impl-lang
39+
40+
Basic Front-End techniques
41+
==========================
42+
43+
* Lexical analysis
44+
* Parsing
45+
* Abstract Syntax Trees
46+
* Type Systems
47+
* Semantic Analysis
48+
49+
Basic Back-end techniques
50+
=========================
51+
52+
* Stack based vs register based Intermediate Representation
53+
* Control flow graphs and Basic Blocks
54+
* Bytecode VM with simple garbage collection
55+
56+
Basic Optimization techniques
57+
=============================
58+
59+
* Dominators and Control Flow Graph
60+
* Data Flow Analysis, Type Lattices, Abstract Interpretation
61+
* Peephole Optimizations
62+
* Static Single Assignment
63+
* Sea of Nodes Representation
64+
* Code generation and Register Allocation
65+
66+
Language Tools
67+
==============
68+
69+
* Debuggers
70+
* Language IDEs
71+
72+
Advanced Front-end techniques
73+
=============================
74+
75+
* Type inference
76+
* Classes and objects
77+
* Closures
78+
* Exception handling
79+
* Gradual typing
80+
* Generics
81+
82+
83+
Some Useful Projects
84+
====================
85+
86+
87+
Book Reviews
88+
============
89+
90+
.. toctree::
91+
:maxdepth: 2
92+
:caption: Reviews
93+
94+
compiler-books
95+
96+

_sources/intro.rst.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Welcome!
2+
========
3+
4+
This is work in progress

_sources/prelim-impl-lang.rst.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Implementation Language
2+
=======================
3+
4+
A compiler can be implemented in any language we choose. For a pedagogical project it is more convenient
5+
to choose a language that is widely used, has garbage collection, and comes with excellent tools such
6+
as IDEs and Debuggers.
7+
8+
Production quality compilers are often written in C, C++ or Rust. For us these languages are too difficult
9+
to work with.
10+
11+
Lisp and Python appear to be popular languages in teaching projects. Lisp is not as widely used
12+
as we would like our implementation language to be, and dynamically typed languages such as Python are
13+
harder to work with as the project grows.
14+
15+
Compared to C, C++ and Rust, the programming language D appears to be much more suitable for this project,
16+
from a technical standpoint, that is. It is a garbage collection language that has less friction and is pleasant to
17+
work with. The main negatives are that it is not a popular language, and the tooling is not up to
18+
the standards of other languages.
19+
20+
Go would be a good candidate except that its an opinionated language that forces a certain programming model,
21+
whereas we would like a language that offers least resistance.
22+
23+
Java, Kotlin, Swift and C# seem like good candidates. Java has some limitations that make it harder to write memory optimized
24+
code that is often necessary in a production compiler, but we don't care so much about that.
25+
26+
I decided to use Java because it is the language I am most familar with, has great tooling, and despite some
27+
short comings, is widely understood by developers around the world. My first choice would have been D if it was
28+
purely a question of technical preference.
29+
30+
The use of Java biases the implementation towards using some Object Orientation; this is just a consequence of the
31+
most comfortable way of expressing some designs in Java.

0 commit comments

Comments
 (0)