 
  
 
  
   
      | 
     
      
         
            | 
            | 
            | 
            | 
         
         
            | 
          
            | 
            | 
         
         
            | 
            Context-Free Grammars
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
           
 | Organization:  | Case Western Reserve University |  
 | Department:  | Department of Mathematics |  
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
            0205-456
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
            1996-11-19
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
            The Mathematica notebook, ContextFreeGrammar.nb, contains a command AcceptQ that takes a context-free grammar and a string as arguments and determines whether the string is generated by the grammar. As a side effect, it prints successively a list of strings that derive to the given string in n steps. It stops and accepts when it finds the start symbol in that list. If it comes up with the empty list, it rejects.
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
           
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
            context-free grammars, context free grammars, parser, backward exhaustive search, forward breadth first search, derivation tree, formal languages, rewrite
   | 
            | 
         
        
            | 
          
            | 
            | 
         
         
            | 
           
  | ContextFreeGrammar.nb (9.1 KB) - Mathematica notebook  |    Files specific to Mathematica 2.2 version:
   |   | ContextFreeGrammar.ma (5.7 KB) - Mathematica notebook  |  
   | 
            | 
         
       
     | 
      | 
   
   
      | 
      | 
      | 
   
 
 |  |   |  |    |  |  
  |