For another cool .y (YACC) and .l (Flex) setup, check out what Postgres uses to parse SQL queries:
https://github.com/postgres/postgres/blob/master/src/backend...
https://github.com/postgres/postgres/blob/master/src/backend...
Link to all files / README: https://github.com/postgres/postgres/tree/master/src/backend...