1 /* $NetBSD: err_syntax27.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */
5 %parse
-param
{ int regs
[26]
6 %parse
-param
{ int *base
16 #define YYLEX_PARAM base
17 #define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
18 #define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
20 static void YYERROR_DECL
();
33 %left UMINUS
/* supplies precedence for unary minus */
35 %%
/* beginning of rules section */
65 |
'-' expr %prec UMINUS
73 { $$
= $1; (*base
) = ($1==0) ?
8 : 10; }
75 { $$
= (*base
) * $1 + $2; }
78 %%
/* start of programs */
81 extern
int YYLEX_DECL
();
96 #define UNUSED(x) ((void)(x))
101 UNUSED
(regs
); /* %parse-param regs is not actually used here */
102 UNUSED
(base
); /* %parse-param base is not actually used here */
103 fprintf
(stderr
, "%s\n", s
);
109 /* lexical analysis routine */
110 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
111 /* return DIGIT for a digit, yylval = 0 through 9 */
112 /* all other characters are returned immediately */
116 while
( (c
=getchar
()) == ' ' ) { /* skip blanks */ }
118 /* c is now nonblank */
125 *yylval = (c
- '0') %
(*base
);