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 09:25:18 +0800


This grammar has no conflictions. But it can't work. Consider such a xml file.
<xml>
<information>
<test value=10003/>
<collections>
<collection>
     <colnum value=10001/>
     <colvalue value="aaa"/>
</collection>
</collections>
</information>
</xml>

when test element is reduced, bison tries to read a token sxmlETag, it tries to
shift by
rule sxmlElement:sxmlSTag sxmlElement sxmlETag.

Johnny Xia.






address@hidden on 06/17/2002 12:59:46 AM
                                                                                
                                                                                
                                                                                


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







Try this :

sxmlDocument          : /*empty*/
                                | sxmlElement
                                ;

sxmlElement             : sxmlSTag sxmlElement sxmlETag
                                | sxmlSTag sxmlETag
                                | sxmlEmptyElement
                                ;

sxmlEmptyElement   : sxmlSTag_2 SLASH CLOSE_ANGLE_BRA
                                ;

sxmlSTag                  : sxmlSTag_2 CLOSE_ANGLE_BRA
                                ;

sxmlSTag_2              : OPEN_ANGLE_BRA NAME sxmlAttrList
                                | OPEN_ANGLE_BRA NAME
                                ;

sxmlAttrList              : sxmlAttr sxmlAttrList
                                | sxmlAttr
                                ;

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
                                ;


try to use /* empty */ with only one rule (the first rule)

Sorry for my poo english : i'm a young french student ;-)

Try this :

sxmlDocument          : /*empty*/
                               | sxmlElement
                               ;

sxmlElement             : sxmlSTag sxmlElement sxmlETag
                               | sxmlSTag sxmlETag
                               | sxmlEmptyElement
                               ;

sxmlEmptyElement   : sxmlSTag_2 SLASH CLOSE_ANGLE_BRA
                               ;

sxmlSTag                  : sxmlSTag_2 CLOSE_ANGLE_BRA
                               ;

sxmlSTag_2              : OPEN_ANGLE_BRA NAME sxmlAttrList
                               | OPEN_ANGLE_BRA NAME
                               ;

sxmlAttrList              : sxmlAttr sxmlAttrList
                               | sxmlAttr
                               ;

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
                               ;


try to use /* empty */ with only one rule (the first rule)

Sorry for my poo english : i'm a young french student ;-)

reply via email to

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