In this Github repository, I'm documenting my journey to write aself-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 whatI 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:
break
and continue
sizeof
static
There isn't a schedule or timeline for the future parts, sojust keep checking back here to see if I've written any more.
I have borrowed some of the code, and lots of ideas, from theSubC compiler written by Nils M Holm.His code is in the public domain. I think that my code is substantiallydifferent enough that I can apply a different license to my code.
Unless otherwise noted,
搬运自https://github.com/DoctorWkt/acwj,一个介绍如何使用C语言编写一个可自举的类C语言编译器的说明。进行了粗略的翻译。 【acwj】04,An Actual Compiler 一个真正的编译器 It’s about time that I met my promise of actually writing a compiler. So in this part
搬运自https://github.com/DoctorWkt/acwj,一个介绍如何使用C语言编写一个可自举的类C语言编译器的说明。进行了粗略的翻译。 【acwj】02, Introduction to Parsing 解析器介绍 In this part of our compiler writing journey, I’m going to introduce the basics of
搬运自https://github.com/DoctorWkt/acwj,一个介绍如何使用C语言编写一个可自举的类C语言编译器的说明。进行了粗略的翻译。 【acwj】01, Introduction to Lexical Scanning 词法扫描介绍 We start our compiler writing journey with a simple lexical scanner. As I
搬运自https://github.com/DoctorWkt/acwj,一个介绍如何使用C语言编写一个可自举的类C语言编译器的说明。进行了粗略的翻译。 【acwj】03, Operator Precedence 运算符优先级 We saw in the previous part of our compiler writing journey that a parser doesn’t nece
搬运自https://github.com/DoctorWkt/acwj,一个介绍如何使用C语言编写一个可自举的类C语言编译器的说明。进行了粗略的翻译。 【acwj】05,Statements 实现“Statements” It ‘s time to add some “proper” statements to the grammar of our language. I want to be