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

Re: Elision, or: Nick rides again in jbonai



   I've considered the use of the <error> production to be a kludge ever
since Jim Brown started it almost ten years ago.  It does allow the parser
to recover from an elided terminator, if you are using YACC.  Of course,
other errors in that position may get mistaken for elided terminators, though
I'm not sure I could throw together an example that would get an error only
at the place of an elided terminator.  It might be fun to try.

   My real question is for Guy.  If one wished to explore the question of
including elidible terminators in the grammar, how would one go about it?
My approach has been to include a rule allowing the terminator to go to an
empty production and then examine the places where conflicts arise.  Those
places are where ambiguities may arise if a terminator is elided.  Beyond
that things seem to get messy.  We don't have tools for hacking on grammars
that make sure the language being defined doesn't change.  Grammar writing
seems to be an art rather than a science.  My compiler theory classes were
almost twenty years ago, but I do read some of the relevant journals.  The
emphasis seems to be on developing better error recovery techniques and on
modifications to the basic LR(k) algorithms which will produce smaller
parsers.  I haven't seen any work on developing tools for grammar writers.