Parsing C with leex and yecc

Joe Armstrong <>
Tue Jul 20 11:28:38 CEST 2010

I'm trying to parser ANSI C with leex and yecc and have run into
two problems.

1) /* ... */ comments. Leex is (as I understand things) greedy
   thus I can't just write a regexp to match comments, since it
   will consume no-only the current comment, but all comments until
   the last comment in the file.

   To solve this I have just written a simple pre-processor to remove comments
   from the original source.

2) The typedef problem.

   How can I parse typedefs using leex and yecc?

   The traditional yacc/lex approach solves this with a context
   sensitive lex and feedback between yacc and lex. But the Erlang
   leex and yacc seem to be written as separated passes, are there some
   internal functions that allow feedback between leex and yacc?


More information about the erlang-questions mailing list