How does one write a non-toy compiler?
been trying to write a compiler for 2 years now, when i started learning rust i wrote one and got to a point where i invented some new tech i am proud of
however this toke a very long time, because i did'nt read much nether books nor others code both were hard for me i had to invent everything from scratch,
i just knew basic lexing and parsing and manged to get to semantic analysis, ir gen and codegen working, the results were a mess i am not even sure if that is how semantic analysis should be done
now i want to write an actual compiler based on the same idea of the previous one however i am not sure where should i start reading about semantic analysis optimization and more i still cannot read PDF nor books but i can read others code i wish more websites existed...
i don't want a beginner guide, i may live with just theory if possible but with details(and example structs maybe?), i don't want a toy compiler
for now my old compiler does:
Lexing(Tokens) -> Parsing(AST) -> Some weird semantic analysis(Typed AST) -> IR Gen (IR) -> Backend(C)
current backend is C but i wanted to make IR as easy as possible to add "plugins" where anyone can write a backend, Typed AST is a complete mess i started changing this to IR directly instead but i realized i need to post this
thanks for reading my first reddit post! hopefully this is not too long