Rodrigo Kumpera - 2003-05-05

You tool is amazing, I'm using it to convert a bison grammar to it, but unfortunely I'm running into some trouble, I had the following grammar on bison working ok:

enum_stmt : K_ENUM '{' enum_list '}'
        | enum_begin '{' enum_list ',' '}'   
;

enum_list : enum_entry
        | enum_list ',' enum_entry
;

enum_entry : IDENTIFIER
      |  IDENTIFIER '=' expression
;

My problem is to produce the same result with cppcc. The problem is to allow the extra ',' after enum_list on enum_stmt.

With cppcc my production is:

() enum_stmt ()
{
<k_enum>
<lbrk>
enum_entry()
( <comma>
LOOKAHEAD({scanner.la()->id != Token::rbrk})  enum_entry() )*
<rbrk>
}

() enum_entry ()
{
   <identifier> ( <assign_op> expression() )?
}

Right now it works just fine, but is it possible to do it but avoiding the use of semantic lookahead?

Thanks!