Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
yacc(1) OSS Shell and Utilities Reference Manual
| expr ’*’ expr
{ $$=$1*$3; }
| expr ’/’ expr
{ $$=$1/$3; }
| expr ’%’ expr
{ $$=$1%$3; }
| expr ’+’ expr
{ $$=$1+$3; }
| expr ’-’ expr
{ $$=$1-$3; }
| expr ’&’ expr
{ $$=$1&$3; }
| expr ’|’ expr
{ $$=$1|$3; }
| ’-’ expr %prec UMINUS
{ $$ = -$2; }
| LETTER
{ $$ = regs[$1]; }
| number
;
number : DIGIT
{ $$ = $1; base = ($1==0) ? 8:10; }
| number DIGIT
{ $$=base*$1+$2; }
;
%%
main()
{
return(yyparse());
}
yyerror(s)
char *s;
{
fprintf(stderr,"%s\n",s);
}
yywrap()
{
return(1);
}
Declarations Section
This section contains entries that perform the following functions:
• Includes standard I/O header file.
• Defines global variables.
• Defines the list rule as the place to start processing.
• Defines the tokens used by the parser.
10−42 Hewlett-Packard Company 527188-003