Recursive Descent Parser for C
c, parsing
Solution
If you don't need C99, then lcc is a slam dunk:
- It is documented in a very clear, well-written book.
- Techniques used for recursive-descent parsing of operators with precedence are well documented in an article and technical report by Dave Hanson.
- Clear, handwritten ANSI C code.
One potential downside is that the `lcc` parser does not build an abstract-syntax tree—it goes straight from parsing to intermediate code.
If you must have C99 then I think tinycc (tcc) is your best bet.
Problem
I'm looking for a parser for C. Here is what I need: - Written in C (not C++). - Handwritten (not generated). - BSD or similarly permissive license. - Capable of nontrivially parsing itself (can be a subset of C). It can be part of a project as long as it's decoupled so that I can pull out the parser. Is there an existing parser that fulfills these requirements?