Skip to content
A Compiler Writing Journey
C C++ Shell Makefile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
00_Introduction Update Readme to mention books Jan 8, 2020
01_Scanner Fixed typos in 01/Readme.md. Nov 4, 2019
02_Parser Fixed typos in 02/Readme.md Nov 4, 2019
03_Precedence The first big tranche of files for my journey so far. Oct 18, 2019
04_Assembly Typo fix Jan 7, 2020
05_Statements Fixed typos up to part 13. Dec 10, 2019
06_Variables Fixed more typos. Dec 12, 2019
07_Comparisons Fixed more typos. Dec 12, 2019
08_If_Statements The first big tranche of files for my journey so far. Oct 18, 2019
09_While_Loops Fixed more typos. Dec 12, 2019
10_For_Loops Fixed more typos. Dec 12, 2019
11_Functions_pt1 Fixed typos up to part 13. Dec 10, 2019
12_Types_pt1 Change type_compatible() so that void is not compatible with Jan 6, 2020
13_Functions_pt2 Fixed typos up to part 13. Dec 10, 2019
14_ARM_Platform Added simple pointers, only x86-64 code so far. Oct 20, 2019
15_Pointers_pt1 Tiny Typo in section 15 Jan 6, 2020
16_Global_Vars Fixed typos up to part 21. Dec 10, 2019
17_Scaling_Offsets Fixed typos up to part 21. Dec 10, 2019
18_Lvalues_Revisited Fixed typos up to part 21. Dec 10, 2019
19_Arrays_pt1 Fixed typos up to part 21. Dec 10, 2019
20_Char_Str_Literals Fixed typos up to part 21. Dec 10, 2019
21_More_Operators Fixed typos up to part 21. Dec 10, 2019
22_Design_Locals Fixed typos up to part 30. Dec 10, 2019
23_Local_Variables Fixed typos up to part 30. Dec 10, 2019
24_Function_Params Fixed typo in Readme.md Nov 3, 2019
25_Function_Arguments Tidied the 25_Function_Arguments/Readme.md up a bit. Nov 4, 2019
26_Prototypes Updated the 26/Readme.md Nov 6, 2019
27_Testing_Errors Fixed typos in 27/Readme.md Nov 6, 2019
28_Runtime_Flags Added some more hyperlinks to 28/Readme.md Nov 8, 2019
29_Refactoring Did a bit of refactoring on the code base. Nov 10, 2019
30_Design_Composites Fixed typos up to part 30. Dec 10, 2019
31_Struct_Declarations Typo fix Jan 6, 2020
32_Struct_Access_pt1 Typo fixed in 32/Readme.md Nov 15, 2019
33_Unions Changed what I'll do in next part. Nov 16, 2019
34_Enums_and_Typedefs Added enums and typedefs. Nov 16, 2019
35_Preprocessor Fixed typos in 35_Preprocessor/Readme.md. Nov 17, 2019
36_Break_Continue Fix 36/Readme typo Nov 18, 2019
37_Switch Fixed typos up to part 61. Dec 10, 2019
38_Dangling_Else Add a bit more code to 38/Readme.md. Nov 21, 2019
39_Var_Initialisation_pt1 Did refactoring to support lists of variables. Nov 23, 2019
40_Var_Initialisation_pt2 Typo in 40/Readme.md. Nov 24, 2019
41_Local_Var_Init Fixed typos up to part 61. Dec 10, 2019
42_Casting Fixed typos up to part 61. Dec 10, 2019
43_More_Operators Added four more operators. Nov 26, 2019
44_Fold_Optimisation Fixed typos up to part 61. Dec 10, 2019
45_Globals_Again Added literal expression parsing. Nov 27, 2019
46_Void_Functions Fixed typos up to part 61. Dec 10, 2019
47_Sizeof Added a subset of sizeof(). Nov 29, 2019
48_Static Fixed typos up to part 61. Dec 10, 2019
49_Ternary Typo in 49/Readme.md. Nov 30, 2019
50_Mop_up_pt1 Fixed typos up to part 61. Dec 10, 2019
51_Arrays_pt2 Fixed typos up to part 61. Dec 10, 2019
52_Pointers_pt2 Fixed typos up to part 61. Dec 10, 2019
53_Mop_up_pt2 More mopping up done. Dec 4, 2019
54_Reg_Spills Fixed typos up to part 61. Dec 10, 2019
55_Lazy_Evaluation Added lazy evaluation. Dec 5, 2019
56_Local_Arrays Added local arrays. Dec 5, 2019
57_Mop_up_pt3 I missed a test result. Dec 7, 2019
58_Ptr_Increments Fixed typos up to part 61. Dec 10, 2019
59_WDIW_pt1 Fixed typos up to part 61. Dec 10, 2019
60_TripleTest Fixed some 60/Readme.md typos. Dec 9, 2019
61_What_Next Mention shorts and unsigned as possible future work. Dec 10, 2019
62_Cleanup Fix typo in 62/Readme.md Dec 14, 2019
LICENSE Initial commit Oct 18, 2019
Readme.md Did a bit of code cleanup. Dec 12, 2019

Readme.md

A Compiler Writing Journey

In this Github repository, I'm documenting my journey to write a self-compiling compiler for a subset of the C language. I'm also writing out the details so that, if you want to follow along, there will be an explanation of what I did, why, and with some references back to the theory of compilers.

But not too much theory, I want this to be a practical journey.

Here are the steps I've taken so far:

There isn't a schedule or timeline for the future parts, so just keep checking back here to see if I've written any more.

Copyrights

I have borrowed some of the code, and lots of ideas, from the SubC compiler written by Nils M Holm. His code is in the public domain. I think that my code is substantially different enough that I can apply a different license to my code.

Unless otherwise noted,

  • all source code and scripts are (c) Warren Toomey under the GPL3 license.
  • all non-source code documents (e.g. English documents, image files) are (c) Warren Toomey under the Creative Commons BY-NC-SA 4.0 license.
You can’t perform that action at this time.