Re: getting bison.simple to report valid tokens on parse errors...

beaty@longs.LANCE.ColoState.Edu
Tue, 13 Mar 90 17:08:39 MST

          From comp.compilers

Related articles
getting bison.simple to report valid tokens on parse errors... beaty@longs.LANCE.ColoState.Edu (1990-03-05)
Re: getting bison.simple to report valid tokens on parse errors... beaty@longs.LANCE.ColoState.Edu (1990-03-13)
| List of all articles for this month |

Date: Tue, 13 Mar 90 17:08:39 MST
From: beaty@longs.LANCE.ColoState.Edu
Keywords: yacc,errors

Well, I've played with bison's error reporting a little more and found
that a small change to the previous patch helps things out. Instead of
starting to look at the zeroth token possibility, it's better to start
at the third. This skips over the internal tokens such as 'error' and
'invalid' which are valid in some grammars. Here is a patch to the
patched bison.simple:


----------------------------------------------------------------------


*** bison.simple Tue Mar 13 16:20:29 1990
--- bison.simple.new Tue Mar 13 16:19:50 1990
***************
*** 387,393 ****
                {
     int x, count;
     count = 0;
! for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
     {
     if (yycheck[x + yyn] == x)
     {
--- 387,393 ----
                {
     int x, count;
     count = 0;
! for (x = 3; x < (sizeof(yytname) / sizeof(char *)); x++)
     {
     if (yycheck[x + yyn] == x)
     {


----------------------------------------------------------------------


hope this helps someone,


steve beaty@longs.lance.colostate.edu





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.