help-bison
[Top][All Lists]
Advanced

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

Re: Help me to eliminate the reduce/shift confliction


From: Johnny_xia
Subject: Re: Help me to eliminate the reduce/shift confliction
Date: Mon, 17 Jun 2002 10:02:21 +0800

Dear Tim,

I am sorry to reply the message so later, I was stucked by another project.
How about this grammar?

sxmlDocument             : /*empty*/
                              | sxmlElement
                              {
                              }
                        ;

sxmlElement                   : OPEN_ANGLE_BRA NAME sxmlAttrList
rest_of_sxmlElement
                              {
                              }
                              ;

rest_of_sxmlElement      : CLOSE_ANGLE_BRA sxmlElementList sxmlETag
                              | SLASH CLOSE_ANGLE_BRA
                              ;

sxmlAttrList             : sxmlAttr sxmlAttrList
                              | /*empty*/
                              ;

sxmlAttr                 : name_equal QUOTEDSTRING
                              | name_equal NUMBER//here is not compliant to
                              ;

name_equal              : NAME EQUAL
                              ;

sxmlETag                 : OPEN_ANGLE_BRA SLASH NAME CLOSE_ANGLE_BRA
                              ;

sxmlElementList               : sxmlElement sxmlElementList
                              ;

The bison complains two usesless rule, here is the output of bison.
Useless rules:

#4     rest_of_sxmlElement :   CLOSE_ANGLE_BRA sxmlElementList sxmlETag;
#11    sxmlETag :    OPEN_ANGLE_BRA SLASH NAME CLOSE_ANGLE_BRA;
#12    sxmlElementList :  sxmlElement sxmlElementList;

Johnny Xia.






Tim Van Holder <address@hidden> on 06/06/2002 03:22:38 PM
                                                                                
                                                                                
                                                                                


                                                              
                                                              
                                                              
 To:      Johnny Xia/WSH/address@hidden                      
                                                              
                                                              
 cc:      address@hidden                                  
                                                              
                                                              
                                                              
                                                              
 Subject: Re: Help me to eliminate the reduce/shift           
          confliction                                         
                                                              







On Thu, 2002-06-06 at 08:53, Tim Van Holder wrote:

I know it's bad form to reply to yourself, but:

> element
> : '<' element-name element-attributes rest-of-element
> ;
>
> element-data

I meant end-of-element here, of course, and not element-data.

> : '/' '>'
> | '>' element-contents end-tag
> ;
>
> (the above is pseudo-code, obviously).









reply via email to

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