home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 823 of 2,753   
   SM Ryan to All   
   Re: Reduce/Reduce conflict in Algol60 gr   
   11 Oct 06 23:22:57   
   
   From: wyrmwif@tsoft.org   
      
   # primary ::=   
   # 	variable |   
      
   # boolean_primary ::=   
   # 	variable |   
      
   # Note the common part between primary and boolean_primary, which leads to   
   # the conflict. The only way that I could resolve this was to merge   
   arithmetic_expression and   
      
   The problem is this is a ambiguous context free grammar, therefore   
   not LR(k). To reduce the variable you need to match it to the   
   declaration elsewhere to decide if it is a Boolean or arithmetic   
   variable.   
      
   So, yes, you instead use a larger grammar that includes erroneous   
   programs, and then use some post parsing work to enforce context   
   sensitive rules.   
      
   # [You could try building types into the grammar like boolean_variable   
   # and boolean_function_designator, but it's not going to be pretty. -John]   
      
   Unless you use a two-level grammar, you cannot write enough productions.   
      
   --   
   SM Ryan http://www.rawbw.com/~wyrmwif/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca