Tag: rust
-
Working Through WACC – chapter 17 void, malloc etc
WACC is this excellent book and I am blogging my way through it. This chapter tackles dynamic memory. Once again I was surprised by the complexity. For c dynamic memory just means calling a few functions and working with the returned pointers … well we already have function calls and pointers, so hard can that…
-
Working Through WACC – chapter 18 structs
WACC is this excellent book Oh my goodness! I expected this to be a tricky chapter but not this hard. Initializers I knew when I wrote the initializer code for arrays that it wouldn’t work for structs, so a complete rewrite for this chapter. Why, well because an array, even a multi dimensional one is…
-
Working Through WACC – Chapter 14 , pointers
WACC is this great book: I am blogging my way through it, chapter by chapter. Major Refactoring Well first off we need to rewrite the parsing of declarations because it just got a lot more complex. I wasnt happy with my previous ‘making it up as you go along’ version – so I am happy…
-
Working Through WACC – Chapter 13 Floats
Lexer I cheated. My lexer does not use regexes, it does a character-by-character analysis. The parsing of floating point literals looked way too complicated so I used fast_float – Rust. This has a nice feature, you can ask it to parse as far as it can converting to floating point, if it finds a valid…
-
Working Through WACC – Chapter 11 , Long Integers
Now working through Part II of the excellent ‘Writing a c Compiler’ chapter 11 is called ‘Long Integers’. I was discussing this with my son-in-law who works in tech, he laughed saying that that was surely not a big change, I though so too. Boy were we wrong. Its interesting to note that at the…
-
Working Through WACC – Chapter 10
WACC is this book and I am blogging my way through it. This is the last chapter in part 1. A quick skim shows its not too hard. Adding The last point means I need to identify the syntax for this in NASM, the book uses gas syntax, and my normal cheat of looking what…
-
Working through ‘WACC’ – Chapter 9 – Functions
WACC means this book And this is my journey through it. Parsing This is a complicated chapter, and I haven’t even got to the code generation part yet Anyway that is now working. On to Code Generation This is where I expected the first major problem of Windows vs Linux / Mac to be. Linux…
-
Working through WACC – Chapter 8, Loops
All part of the series about this book: Time to add while, do {} while, for, break and continue. And just because all text is boring here’s a picture: This is where I started to doubt my single phase parse direct to TACKY. Particularly in the extra credit. For Loops A for loop like this:…
-
Working Through WACC – Chapter 7, Compound statements
Because we haven’t had it for a while here’s the front cover. If you are not sure what this post is about check out episode 1 https://jollygoodsw.wordpress.com/2025/03/13/working-through-writing-a-c-compiler/ This is a short chapter, the only real change is that the variable name / scope resolution gets fancier. This is beacuse we can now have Ie we…
-
Working through ‘Writing A C Compiler’ – Introduction
The introduction covers a lot of important stuff about implementing the compiler. Platforms The book is setup to work on Linux and Mac. I am a primarily Windows dev (ex MSFT employee), I do a fair amount of contributions to rust projects and so do stuff on all three platforms, but Windows is where I…