•
Translation rules are in the form:
R
E
Action
•
Action
is a program routine that specifies what
to do when a lexeme is specified by
R
E
Section II: Translation Rules
Example:
if
return(IF);
then
return(THEN);
{id}
{ yylval = install_id();
return(ID); }
{integer}
{ yylval = install_int();
return(INT); }
yylval
: value returned by install_id() = attribute of token
3
3/35