Compiler Compiler).
Work with lex. YACC calls yylex to get the next token.
YACC and lex must agree on the values for each token.
All tokens used in the yacc grammar need to be specified. Some tokens
recognized by lex may not be in the yacc grammar token. See lexer.l Non-
terminals do not need to be specified.
See example3.y
Attribute grammar with yacc
Each symbol can be associated with some
attributes.
Data structure of the attributes can be specified in the union in the
declarations. (see example4.y).
%union {
int semantic_value;
}
%token <semantic_value> INTEGERCONST 2
%type <semantic_value> exp
%type <semantic_value> term
%type <semantic_value> item