Lab 5: Building a syntax tree

  1. Download skeleton files.
  2. Different way of writing grammars:
    ProductionsGrammarsAlternate grammars
    ExpList    -> Exp ExpRest*    
               ->
    
    ExpRest    -> , Exp
    
    ExpList    : Exp ExpRestSeq
               | /* Empty */
               ;
    
    ExpRestSeq : ExpRestSeq ExpRest    
               | /* Empty */
               ;
    
    ExpRest    : ',' Exp
               ;
    
    ExpList    : ExpList_ne
               | /* Empty */
               ;
    
    ExpList_ne : ExpList_ne ',' Exp
               | Exp
               ;
    
  3. Classes hierarchy: