Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flex/Bison based lexer/parser for C language

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.

like image 724
Mahdi Avatar asked Dec 19 '25 07:12

Mahdi


2 Answers

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.

like image 63
Mikhail Maltsev Avatar answered Dec 21 '25 22:12

Mikhail Maltsev


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

like image 20
user3813674 Avatar answered Dec 21 '25 21:12

user3813674



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!