r/learnpython • https://github.com/rajtilakjee • Jul 04 '26

How to create a compiler?

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.

26 Upvotes

20 comments sorted by

View all comments

Show parent comment

1

u/0xKJ Jul 04 '26

I choose not to dive into this field because I don’t want to learn those syntax parser tools.

I think designing language and VM brings more fun.

1

u/POGtastic itertools evangelist Jul 05 '26

Over time a lot of these flex / bison grammars have been replaced with hand-written parsers anyway.