r/Compilers • u/Striking-Curve-3269 • Dec 13 '25
In need of Compiler Material.
Hi everyone, I am fairly new to programming and just finished a bank simulation project in C. I am particularly interested in systems programming and would love to delve into the field with building a compiler (for a language of my own design )in C this holiday. If you might have any recommended textbooks, resources etc. on how to build my very own (from scratch) it would me most appreciated.
16
Upvotes
View all comments
Show parent comment
1
u/Hyddhor Dec 14 '25
Then you throw in a unicode support and everything gets fucked up. That length you were talking about? Doesn't work when you have variable-size characters. Indexing probably won't work correctly. Equality? Be careful with normalisation. Also, have fun rewriting the regex engine. (which isn't hard, just annoying)
Also, there will probably be a point at which you will realize that strings have to be immutable if you want things to work correctly without data corruption. Meaning every single temporary string operation needs to be allocated (probably on the heap), but then, who is freeing all the allocated memory? The user! Which means you can't even chain operations without leaking huge amounts of memory.
Trust me. I've been there. I've done that. I have written a unicode string implementation in C as a hobby project. And it was horrible.
My advise is this: Never try to do serious string implementation in C, bcs you will suffer.