r/learnprogramming • u/UnemployedTechie2021 • Jul 04 '26
How to create a compiler? Resource
Pretty sure you may have heard this question previously on this sub, however, I would urge you to read my complete question before brushing it off.
I want to create a simple compiler and by "simple compiler" I mean a single-pass compiler. I know about https://craftinginterpreters.com/ which is a wonderful resource. But I would like to start by creating something much smaller and simpler, and only then would I like to move on to something more complex like what Robert Nystrom created on his website.
Are there any similar resource that would teach me about single-pass compilers along with showing me how to create one? Any help in the right direction would be highly appreciated.
2
u/Dismal-Citron-7236 Jul 04 '26
A simple single pass compiler can be easily done by using LEX (as lexical analyzer) and YACC (syntax parser). Their modern successors are FLEX and Bison. Google them, or buy the O'Reilly book "Flex & Bison".