2
votes

Is there a simple lexer/parser for C language or a subset of it which is based on Flex/Bison?

I have found some open source parsers for C (TCC, LCC, ...) but none of them are based on bison.

2
Adding a comment stating the reason of downvote would be much more useful for me. - Mahdi

2 Answers

4
votes

There is a C11 grammar for YACC (a predecessor of Bison), it should work with Bison (maybe some tweaks will be needed).

GCC used to be based on Bison a long ago. GCC 3.4 source code contains a file with C grammar.

2
votes

This is an implementation of a compiler for a subset of C using bison/flex.