Hacker News new | ask | show | jobs
by hypervis0r 3230 days ago
You can't really write a compiler if you don't know all the "weird things" of the language.
1 comments

Sure you can, it just won't be "right." It depends on your use case and target audience if you care about "right" vs "functional." I'd say anyone who wants to really understand how programming works, should write at least one toy compiler/interpreter. It's interesting the kinds of insights you can pickup trying to pull that off.
Getting back to this particular case, there's something to be said for the idea of learning C before trying to replace C. C certainly isn't a flawless language, but now it's hard to have much faith that OP knows it well enough to understand its flaws.
Is this intended to replace C? I don't see anything that suggests that's what this project is about.

All I see is "C with different syntax". That could easily be a challenging side project whilst learning compilers / language design.

I've always found changing things up a useful means of practice. I wanted to learn how HTTP servers worked. I wanted to learn more Lisp. I implemented it in Common Lisp. I learned a lot.

As a point of reference, implementing a broken, partially complete, and definitely error filled version of Scheme on C is how I finally wrapped my head around Lisp. I'd been running into that one for a long time before figuring out.