help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run-time selection of bison rule reduction?


From: Casey Leedom
Subject: Run-time selection of bison rule reduction?
Date: Fri, 26 Apr 2002 11:04:38 -0700

Greetings,

  I'm trying to fix a POSIX-compliance bug in flex.  This bug has to do with
the precedence of the repeat operator, {}.  Under POSIX and AT&T lex the
Extended Regular Expression (ERE) repeat operator has a lower precedence
than concatenation (ab{3} yields ababab).  This is different from the ERE
precedence rules used by many other POSIX/UNIX utilities where the repeat
operator has higher precedence (ab{3} yields abbb).

  When Vern Paxson implemented flex he apparently accidentally missed this
subtle distinction and even noted the difference in precedence between lex
and flex as being a POSIX compliance change he had made in flex.  (Reading
and implementing standards is a notoriously difficult task.)

  The fix to the flex bison parser is actually very simple but the flex
maintainer, Will Estes, has very legitimate concerns about compatibility for
lexical scanners written for flex.

  We could obviously #ifdef parse.y and dual compile flex but this would be
somewhat awkward.  It's been a long time since I wrote a yacc/bison parser
from scratch but I could have sworn that there was a way to provide the
bison parser with run-time state information to allow it to disambiguate
between two identical reductions.  Unfortunately I can't find anything in
the documentation that's striking a chord.  Is this possible or am I
suffering a brain fart?  Thanks for any help and suggestions you can offer!

Casey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]