1%{ 2int yylex(void); 3static void yyerror(const char *); 4%} 5 6%union { 7 int ival; 8 double dval; 9} 10 11%union { 12 int ival2; 13 double dval2; 14} 15 16%start expr 17%type <tag2> expr 18 19%token NUMBER 20 21%% 22 23expr : '(' recur ')' 24 ; 25 26recur : NUMBER 27 { $$ = 1; } 28 ; 29 30%% 31 32#include <stdio.h> 33 34int 35main(void) 36{ 37 printf("yyparse() = %d\n", yyparse()); 38 return 0; 39} 40 41int 42yylex(void) 43{ 44 return -1; 45} 46 47static void 48yyerror(const char* s) 49{ 50 printf("%s\n", s); 51} 52