Live data from Hacker News

Writing a C compiler in 500 lines of Python (2023)

vgel.me

1–10 of 114 posts

Re: Writing a C compiler in 500 lines of Python (2023)

#10
post #6

This article breaks it down well enough to make me feel like I could write my own C compiler targeting AVR. (I probably could... but it would not be easy.) Never actually looked into how compilers work before, it's surprisingly similar/related to linguistics.

It's b/c when Chomsky invented the theory of formal grammars he was studying natural languages & the universality of abstract grammar¹. Computer scientists realized later that they could use the same theory as a foundation for formalizing the grammatical structures of programming languages.

¹https://en.wikipedia.org/wiki/Chomsky_hierarchy

Post reply on HN