Semantic Actions, Semantic Records and All ThatTopYACC

YACC

  1. Yacc is a parser generator.
  2. Basic form of input specification contains three main secitons
    1. Declarations and directives for the parser generator
    2. Rules of grammar
    3. Program text (i.e. action routines, ... )
    separated by lines containing only "%%".
  3. Grammar Rules
  4. Declarations.
  5. Standardizing dates: An example.
    %token MONTH
    %token NUMBER
    
    %%
    date : day MONTH year
         | monthnum '/' day '/' year
         | MONTH day ',' year
         ;
    
    monthnum : NUMBER ;
    day  : NUMBER  ;
    year : NUMBER  ;
          

Computer Science 434
Department of Computer Science
Williams College

Semantic Actions, Semantic Records and All ThatTopYACC