bison-patches
[Top][All Lists]
Advanced

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

Re: TODO update


From: Akim Demaille
Subject: Re: TODO update
Date: 23 Jul 2002 14:52:25 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

|  > OK.  Then I must have missed the bits where the tables are changed.
|  > Hm...
| 
| In output.c:
|         /* GLR parsers need space for conflict lists, so we can't
|            default conflicted entries.  For non-conflicted entries
|            or as long as we are not building a GLR parser,
|            actions that match the default are replaced with zero,
|            which means "use the default". */
| 
|         if (max > 0)
|           {
|             int j;
|             for (j = 0; j < ntokens; j++)
|               if (actrow[j] == -default_rule
|                   && ! (glr_parser && conflrow[j]))
|                 actrow[j] = 0;
|           }
|       }

Indeed.

|  > Would you say we ought to keep the same `output', with $default, as a
|  > means to compress output, not the parser?
| 
| Oh, I don't really think so.  It would require extra work to do so
| (since the entry doesn't look defaulted in GLR mode at the point the
| report is made), and I really don't expect there to be a huge number
| of conflicting entries in general anyway.

There is something which remains unclear to me: you seem to say we
should not display them as $default, but they are.  They are because
conflrow and others are not used to generate .output.  I see this as a
flaw, agreed, but for the time being there remain a lot of things to
clean up before that.  And care will be needed, since it means
increasing (again) the memory footprint.

Today, on:

   %glr-parser
   %%
   exp: exp '+' exp
      | exp '+' exp
      | '0'
      ;
   %%

one has:

| State 5 contains 1 shift/reduce conflict and 2 reduce/reduce conflicts.
| 
| 
| Grammar
| 
|     0 $axiom: exp $
| 
|     1 exp: exp '+' exp
|     2    | exp '+' exp
|     3    | '0'
| 
| 
| Terminals, with rules where they appear
| 
| $ (0) 0
| '+' (43) 1 2
| '0' (48) 3
| error (256)
| 
| 
| Nonterminals, with rules where they appear
| 
| $axiom (5)
|     on left: 0
| exp (6)
|     on left: 1 2 3, on right: 0 1 2
| 
| 
| state 0
| 
|     0 $axiom: . exp $
|     1 exp: . exp '+' exp
|     2    | . exp '+' exp
|     3    | . '0'
| 
|     '0'  shift, and go to state 1
| 
|     exp  go to state 2
| 
| 
| state 1
| 
|     3 exp: '0' .
| 
|     $default  reduce using rule 3 (exp)
|
| 
| state 2
| 
|     0 $axiom: exp . $
|     1 exp: exp . '+' exp
|     2    | exp . '+' exp
| 
|     $    shift, and go to state 3
|     '+'  shift, and go to state 4
| 
| 
| state 3
| 
|     0 $axiom: exp $ .
| 
|     $default  accept
| 
| 
| state 4
| 
|     1 exp: . exp '+' exp
|     1    | exp '+' . exp
|     2    | . exp '+' exp
|     2    | exp '+' . exp
|     3    | . '0'
| 
|     '0'  shift, and go to state 1
| 
|     exp  go to state 5
| 
| 
| state 5
| 
|     1 exp: exp . '+' exp  [$, '+']
|     1    | exp '+' exp .  [$, '+']
|     2    | exp . '+' exp  [$, '+']
|     2    | exp '+' exp .  [$, '+']
| 
|     '+'  shift, and go to state 4
| 
|     $         reduce using rule 1 (exp)
|     $         [reduce using rule 2 (exp)]
|     '+'       [reduce using rule 1 (exp)]
|     '+'       [reduce using rule 2 (exp)]
|     $default  reduce using rule 1 (exp)

The presentation of this state is very confusing.



reply via email to

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