←back to thread

429 points rui314 | 1 comments | | HN request time: 0s | source
Show context
peter303 ◴[] No.10732006[source]
Long ago UNIX had compiler writing tools like yacc and lex. I wonder if they are useful for exercises like this.
replies(6): >>10732067 #>>10732084 #>>10732219 #>>10732591 #>>10732595 #>>10732964 #
1. eliben ◴[] No.10732591[source]
Here's a complete C frontend that uses the lex/yacc approach - https://github.com/eliben/pycparser (the Python ports of them, that is)

FWIW, if I had to do this again today I would certainly go for hand-written recursive descent. lex/yacc charm you in but eventually prove to be much more difficult to tweak and reason about.