Contents    Page-10    Prev    Next    Page+10    Index   

Comments on the Example[slide by John Werth.]

The statement #define YYSTYPE double sets YYSTYPE, the type of the yacc semantic stack. This stack parallels the syntax stack maintained by the LALR parser. References like $1 to values in the the right hand side of a production are actually references to this stack of values. This stack could have record type or union type; the latter is typical for a compiler.

Note that a grammar may be ambiguous, with parsing action conflicts; yacc will report this.

To see the sets of items and the specific parsing action conflicts, use the yacc -v option. The diagnostic information will be produced in a file called y.output .


   yacc -v parse.y