Lines Matching +full:3 +full:base +full:- +full:x
1 %pure-parser
3 %parse-param { int regs[26] }
4 %parse-param { int *base }
6 %lex-param { int *base }
14 #define YYLEX_PARAM base
16 #define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
29 %left '+' '-'
44 { regs[$1] = $3; }
50 { $$ = $1 + $3; }
51 | expr '-' expr
52 { $$ = $1 - $3; }
54 { $$ = $1 * $3; }
56 { $$ = $1 / $3; }
58 { $$ = $1 % $3; }
60 { $$ = $1 & $3; }
62 { $$ = $1 | $3; }
63 | '-' expr %prec UMINUS
64 { $$ = - $2; }
71 { $$ = $1; (*base) = ($1==0) ? 8 : 10; }
73 { $$ = (*base) * $1 + $2; }
86 int base = 10; in main() local
89 yyparse(regs, &base); in main()
94 #define UNUSED(x) ((void)(x)) argument
99 UNUSED(regs); /* %parse-param regs is not actually used here */ in YYERROR_DECL()
100 UNUSED(base); /* %parse-param base is not actually used here */ in YYERROR_DECL()
119 *yylval = (c - 'a'); in YYLEX_DECL()
123 *yylval = (c - '0') % (*base); in YYLEX_DECL()