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 2,094 of 2,753   
   Hans Aberg to Borneq   
   Re: How detect cycle in grammar ?   
   21 Nov 11 18:14:05   
   
   From: haberg-news@telia.com   
      
   On 2011/11/20 17:48, Borneq wrote:   
   > A->B   
   > B->B   
   > This grammar is not correct, B is looped.   
   >   
   > A->B   
   > B->C   
   > C->A   
   > This another grammar, cycle can be arbitrarily long.   
   > Is cycle when First(Nonterminal) not contain any terminal, even not   
   > epsilon?   
      
   If it is only cycles in the graph you are out for, perhaps some   
   algorithm mentioned here might help:   
      https://en.wikipedia.org/wiki/Strongly_connected_component   
      https://en.wikipedia.org/wiki/Cycle_detection   
      
   Hans   
      
   --- 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