Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

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 le.
Denes global variables.
Denes the list rule as the place to start processing.
Denes the tokens used by the parser.
1042 Hewlett-Packard Company 527188-004