extern void perror (const char *s);
%}
+/* Also exercise %union. */
+%union
+{
+ int ival; /* A comment to exercise an old bug. */
+};
+
/* Bison Declarations */
%token CALC_EOF 0 "end of file"
-%token NUM "number"
+%token <ival> NUM "number"
+%type <ival> exp
%nonassoc '=' /* comparison */
%left '-' '+'
line:
'\n'
-| exp '\n'
+| exp '\n' {}
;
exp:
if (c == '.' || isdigit (c))
{
yyungetc (c);
- yylval = read_signed_integer ();
+ yylval.ival = read_signed_integer ();
return NUM;
}
1 - (2 - 3) = 2
2^2^3 = 256
-(2^2)^3 = 64], [488])
+(2^2)^3 = 64], [486])
# Some parse errors.
_AT_CHECK_CALC_ERROR([$1], [0 0], [10],