Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From my experience, implementing a programming language can be easier to grasp when doing it backwards, that is: back end -> front end. I can recommend The BNF Converter (http://bnfc.digitalgrammars.com/), which is a tool that generates the front end (C, C++, C#, Haskell, Java, or OCaml) from BNF grammar. Writing a back end gives you pretty clear big picture of how different parts work and relate to each other. When you have that you can write the front end with this vision.

Obviously, this is only my experience, but I thought of sharing, since in almost every compiler course I've seen everything starts with writing the front end. I still have a very, very limited experience and knowledge, but after I learn more about implementing PL/writing compilers, I see it everywhere.



I recommend http://www.hokstad.com/compiler , which covers the process of writing a compiler in the way that makes sense to me, the way you'd write any other program.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: