%%
.
The head section contains declarations, code support
and directives.
The grammar rules describing
the language - and the semantic actions that indicate how
evaluate the attributes associated with the symbols -
reside in the body section.
The tail section includes Perl code that gives support
to the semantic actions. Commonly
the lexical analyzer and error diagnostic subroutines
go there.
%right '=' # Head section %left '-' '+' %left '*' '/' %left NEG %tree %% line: # Body section sts <%name EXPS + ';'> ; sts: %name PRINT PRINT leftvalue | exp ; exp: %name NUM NUM | %name VAR VAR | %name ASSIGN leftvalue '=' exp | %name PLUS exp '+' exp | %name MINUS exp '-' exp | %name TIMES exp '*' exp | %name DIV exp '/' exp | %name NEG '-' exp %prec NEG | '(' exp ')' ; leftvalue : %name VAR VAR ; %% ... # tail section