seq0        : '0' seq0 | '0' ;
seq1        : '1' seq1 | '1' ;
and '1' and to resolve it by the shift:

%right '0' '1'

but it would mask any other conflicts involving 0 and 1, so I'd use the
expect so you'll see any other unintended conflicts.


If you have a classic flex/bison setup and want this greedy behavior, I'd 
recommend simply putting the sequences in the lexer:

flex:
- - - - - - - - - -
0+ { yylval.num = strlen(yytext); return ZEROS; }
1+ { yylval.num = strlen(yytext); return ONES; }
- - - - - - - - - -

If it were indeed just a sequence of digit zero or one, I would agree, but I presume the actual stuff in the lists is considerably more complex.

Even if it were, your flex patterns won't work if the language allows white space or comments between the tokens.

R's,
John


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to