←back to thread

429 points rui314 | 1 comments | | HN request time: 0.001s | 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 #
nly ◴[] No.10732219[source]
They might, although no production quality C or C++ compiler uses anything other than a hand-rolled recursive descent parser, afaik.

The lex, parse and AST directories in Clangs source tree are ~100,000 LOC combined, and all hand-written.

replies(2): >>10732576 #>>10735743 #
1. alricb ◴[] No.10735743[source]
Not now, no, but back in the 4.0 days (2005) GCC still used a yacc/bison parser for C; it had switched to a hand written parser for C++. The C++ yacc parser was still in use as of GCC 3.3 (2003).