3

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.

splash
  • 13,037
  • 1
  • 44
  • 67
Mahdi
  • 1,871
  • 2
  • 24
  • 41

2 Answers2

5

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.

Mikhail Maltsev
  • 1,632
  • 11
  • 21
2

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

user3813674
  • 2,553
  • 2
  • 15
  • 26